From 3caf8614f25d6b1962e20331fdf423c863bc02f3 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:13:31 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835144 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca-java-integration/buildtools/LICENSE.txt | 202 +++ .../sca-java-integration/buildtools/NOTICE.txt | 14 + .../sca-java-integration/buildtools/pom.xml | 58 + .../src/main/resources/tuscany-checkstyle.xml | 295 ++++ .../src/main/resources/tuscany-suppressions.xml | 32 + sca-java-1.x/branches/sca-java-integration/pom.xml | 81 ++ .../sca-java-integration/pom/parent/pom.xml | 199 +++ .../samples/sca/bigbank/LICENSE.txt | 416 ++++++ .../samples/sca/bigbank/NOTICE.txt | 32 + .../samples/sca/bigbank/account/.pmd | 20 + .../samples/sca/bigbank/account/.ruleset | 190 +++ .../samples/sca/bigbank/account/LICENSE.txt | 416 ++++++ .../samples/sca/bigbank/account/NOTICE.txt | 32 + .../samples/sca/bigbank/account/pom.xml | 178 +++ .../services/account/AccountServiceImpl.java | 279 ++++ .../services/accountdata/AccountDataService.java | 87 ++ .../accountdata/AccountDataServiceDASImpl.java | 400 ++++++ .../accountdata/AccountDataServiceImpl.java | 106 ++ .../services/accountdata/CustomerIdService.java | 98 ++ .../account/services/accountdb/AccountDBInit.java | 465 +++++++ .../AccountLoggerDataServiceImpl.java | 129 ++ .../accountlogger/AccountLoggerService.java | 47 + .../accountlogger/AccountLoggerServiceImpl.java | 216 +++ .../account/services/stockquote/StockQuote.java | 228 ++++ .../services/stockquote/StockQuoteService.java | 31 + .../services/stockquote/StockQuoteServiceImpl.java | 68 + .../StockQuoteWebservicexServiceImpl.java | 153 +++ .../src/main/resources/DasAccountConfiguration.xml | 79 ++ .../src/main/resources/META-INF/LICENSE.txt | 416 ++++++ .../account/src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/wsdl/AccountService.wsdl | 467 +++++++ .../resources/wsdl/stockquotes.webservicex.wsdl | 136 ++ .../account/src/main/webapp/WEB-INF/default.scdl | 80 ++ .../account/src/main/webapp/WEB-INF/web.xml | 70 + .../java/bigbank/account/client/AccountClient.java | 56 + .../samples/sca/bigbank/docs/Show.Image.html | 40 + .../samples/sca/bigbank/docs/accountfiles.png | Bin 0 -> 15889 bytes .../samples/sca/bigbank/docs/accountmodule.png | Bin 0 -> 33300 bytes .../samples/sca/bigbank/docs/modualoverview.png | Bin 0 -> 6074 bytes .../samples/sca/bigbank/docs/webclientfiles.png | Bin 0 -> 17123 bytes .../samples/sca/bigbank/docs/webclientmodule.png | Bin 0 -> 10748 bytes .../samples/sca/bigbank/pom.xml | 36 + .../samples/sca/bigbank/readme.html | 894 +++++++++++++ .../samples/sca/bigbank/webclient/.pmd | 20 + .../samples/sca/bigbank/webclient/.ruleset | 190 +++ .../samples/sca/bigbank/webclient/LICENSE.txt | 416 ++++++ .../samples/sca/bigbank/webclient/NOTICE.txt | 32 + .../samples/sca/bigbank/webclient/pom.xml | 167 +++ .../account/AccountServiceComponentImpl.java | 117 ++ .../services/profile/AccountLoginServiceImpl.java | 64 + .../webclient/services/profile/LoginService.java | 36 + .../webclient/services/profile/ProfileService.java | 42 + .../services/profile/ProfileServiceImpl.java | 69 + .../services/profile/SimpleLoginServiceImpl.java | 51 + .../webclient/tags/account/AccountLogTag.java | 120 ++ .../webclient/tags/account/AccountStatusTag.java | 135 ++ .../webclient/tags/account/StockLogTag.java | 81 ++ .../webclient/tags/account/StockStatusTag.java | 85 ++ .../webclient/tags/sca/LoginBarrierTag.java | 101 ++ .../bigbank/webclient/tags/sca/ServiceTag.java | 107 ++ .../java/bigbank/webclient/ui/FormServlet.java | 161 +++ .../java/bigbank/webclient/ui/LoginServlet.java | 96 ++ .../src/main/resources/META-INF/LICENSE.txt | 416 ++++++ .../webclient/src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/wsdl/AccountService.wsdl | 466 +++++++ .../webclient/src/main/webapp/CustomerProfile.jsp | 100 ++ .../src/main/webapp/WEB-INF/bigbank-tags.tld | 127 ++ .../webclient/src/main/webapp/WEB-INF/default.scdl | 53 + .../webclient/src/main/webapp/WEB-INF/web.xml | 83 ++ .../webclient/src/main/webapp/accountLog.jsp | 99 ++ .../src/main/webapp/accountTransaction.jsp | 50 + .../bigbank/webclient/src/main/webapp/login.html | 60 + .../webclient/src/main/webapp/purchaseStock.jsp | 59 + .../webclient/src/main/webapp/stockSale.jsp | 56 + .../bigbank/webclient/src/main/webapp/summary.jsp | 144 ++ .../webclient/client/TestAccountService.java | 45 + .../bigbank/webclient/client/TestLoginService.java | 42 + .../samples/sca/calculator/pom.xml | 70 + .../samples/sca/calculator/readme.html | 103 ++ .../src/main/java/calculator/AddService.java | 25 + .../src/main/java/calculator/AddServiceImpl.java | 35 + .../src/main/java/calculator/CalculatorClient.java | 46 + .../main/java/calculator/CalculatorService.java | 35 + .../java/calculator/CalculatorServiceImpl.java | 72 + .../src/main/java/calculator/DivideService.java | 25 + .../main/java/calculator/DivideServiceImpl.java | 33 + .../src/main/java/calculator/MultiplyService.java | 25 + .../main/java/calculator/MultiplyServiceImpl.java | 33 + .../src/main/java/calculator/SubtractService.java | 25 + .../main/java/calculator/SubtractServiceImpl.java | 33 + .../src/main/resources/Calculator.composite | 52 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../calculator/src/main/resources/META-INF/NOTICE | 18 + .../test/java/calculator/CalculatorTestCase.java | 53 + .../samples/sca/composite-impl/pom.xml | 79 ++ .../src/main/java/composite/CompositeClient.java | 26 + .../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 | 44 + .../src/main/resources/InnerComposite2.composite | 33 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/OuterComposite.composite | 37 + .../src/test/java/composite/CompositeTestCase.java | 52 + .../samples/sca/echo-binding/.ruleset | 190 +++ .../samples/sca/echo-binding/NOTICE.txt | 14 + .../samples/sca/echo-binding/pom.xml | 64 + .../src/main/java/echo/EchoBinding.java | 31 + .../src/main/java/echo/EchoBindingLoader.java | 59 + .../src/main/java/echo/EchoBuilder.java | 52 + .../src/main/java/echo/EchoInvoker.java | 66 + .../src/main/java/echo/EchoReference.java | 49 + .../src/main/java/echo/EchoService.java | 45 + .../resources/META-INF/sca/extension.composite | 36 + .../echo-binding/src/test/java/echo/Client.java | 27 + .../src/test/java/echo/ClientImpl.java | 40 + .../sca/echo-binding/src/test/java/echo/Echo.java | 27 + .../src/test/java/echo/EchoBindingTestCase.java | 47 + .../src/test/resources/EchoBinding.composite | 37 + .../samples/sca/echo-databinding/.ruleset | 190 +++ .../samples/sca/echo-databinding/NOTICE.txt | 14 + .../samples/sca/echo-databinding/pom.xml | 104 ++ .../src/main/java/echo/EchoBinding.java | 32 + .../src/main/java/echo/EchoBindingLoader.java | 58 + .../src/main/java/echo/EchoBuilder.java | 52 + .../src/main/java/echo/EchoInvoker.java | 68 + .../src/main/java/echo/EchoReference.java | 55 + .../src/main/java/echo/EchoService.java | 44 + .../resources/META-INF/sca/extension.composite | 31 + .../src/test/java/echo/ComponentAImpl.java | 94 ++ .../src/test/java/echo/ComponentBImpl.java | 59 + .../echo-databinding/src/test/java/echo/Echo.java | 32 + .../test/java/echo/EchoDataBindingTestCase.java | 49 + .../src/test/java/echo/Interface1.java | 32 + .../src/test/java/echo/Interface2.java | 36 + .../src/test/resources/EchoDataBinding.composite | 61 + .../src/test/resources/wsdl/echo.wsdl | 45 + .../samples/sca/loanapplication/pom.xml | 71 + .../main/java/loanapplication/LoanApplication.java | 35 + .../loanapplication/LoanApplicationClient.java | 41 + .../src/main/java/loanapplication/LoanClient.java | 29 + .../main/java/loanapplication/LoanClientImpl.java | 64 + .../src/main/java/loanapplication/LoanService.java | 37 + .../main/java/loanapplication/LoanServiceImpl.java | 63 + .../src/main/resources/loanapplication.composite | 31 + .../loanapplication/LoanApplicationTestCase.java | 83 ++ .../sca-java-integration/samples/sca/pom.xml | 86 ++ .../samples/sca/simple-bigbank/pom.xml | 71 + .../main/java/bigbank/account/AccountReport.java | 36 + .../main/java/bigbank/account/AccountService.java | 27 + .../java/bigbank/account/AccountServiceImpl.java | 47 + .../src/main/java/bigbank/accountdata/Account.java | 27 + .../bigbank/accountdata/AccountDataService.java | 29 + .../accountdata/AccountDataServiceImpl.java | 57 + .../java/bigbank/accountdata/CheckingAccount.java | 36 + .../java/bigbank/accountdata/SavingsAccount.java | 36 + .../java/bigbank/accountdata/StockAccount.java | 40 + .../src/main/resources/BigBank.composite | 44 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/test/java/bigbank/BigBankTestCase.java | 47 + .../samples/sca/simple-callback/pom.xml | 71 + .../src/main/java/simplecallback/MyClient.java | 27 + .../src/main/java/simplecallback/MyClientImpl.java | 47 + .../src/main/java/simplecallback/MyService.java | 32 + .../java/simplecallback/MyServiceCallback.java | 27 + .../main/java/simplecallback/MyServiceImpl.java | 51 + .../java/simplecallback/SimpleCallbackClient.java | 42 + .../src/main/resources/simplecallback.composite | 31 + .../simplecallback/SimpleCallbackTestCase.java | 51 + .../samples/sca/supplychain/pom.xml | 71 + .../samples/sca/supplychain/readme.htm | 89 ++ .../samples/sca/supplychain/run.bat | 7 + .../src/main/java/supplychain/Customer.java | 33 + .../java/supplychain/CustomerComponentImpl.java | 48 + .../src/main/java/supplychain/Retailer.java | 28 + .../java/supplychain/RetailerComponentImpl.java | 43 + .../src/main/java/supplychain/Shipper.java | 28 + .../java/supplychain/ShipperComponentImpl.java | 43 + .../main/java/supplychain/SupplyChainClient.java | 46 + .../src/main/java/supplychain/Warehouse.java | 28 + .../java/supplychain/WarehouseComponentImpl.java | 43 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../supplychain/src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/supplychain.composite | 42 + .../supplychain/SupplyChainClientTestCase.java | 53 + .../samples/sca/webapp/LICENSE.txt | 202 +++ .../samples/sca/webapp/NOTICE.txt | 14 + .../samples/sca/webapp/pom.xml | 49 + .../webapp/src/main/webapp/WEB-INF/default.scdl | 26 + .../sca/webapp/src/main/webapp/WEB-INF/web.xml | 26 + .../samples/sca/webapp/src/main/webapp/calc.jsp | 43 + .../sca/extensions/axis2/binding/.ruleset | 190 +++ .../sca/extensions/axis2/binding/LICENSE.txt | 202 +++ .../sca/extensions/axis2/binding/NOTICE.txt | 14 + .../sca/extensions/axis2/binding/pom.xml | 146 ++ .../axis2/binding/src/main/assembly/axis2.xml | 38 + .../binding/axis2/Axis2AsyncTargetInvoker.java | 94 ++ .../tuscany/binding/axis2/Axis2BindingBuilder.java | 331 +++++ .../axis2/Axis2BindingBuilderRuntimeException.java | 65 + .../axis2/Axis2BindingRunTimeException.java | 48 + .../axis2/Axis2CallbackInvocationHandler.java | 50 + .../binding/axis2/Axis2OneWayTargetInvoker.java | 72 + .../binding/axis2/Axis2ReferenceBinding.java | 194 +++ .../binding/axis2/Axis2ReferenceCallback.java | 56 + .../axis2/Axis2ReferenceCallbackTargetInvoker.java | 114 ++ .../tuscany/binding/axis2/Axis2ServiceBinding.java | 390 ++++++ .../axis2/Axis2ServiceCallbackTargetInvoker.java | 120 ++ .../axis2/Axis2ServiceInMessageReceiver.java | 68 + .../Axis2ServiceInOutAsyncMessageReceiver.java | 91 ++ .../Axis2ServiceInOutSyncMessageReceiver.java | 117 ++ .../tuscany/binding/axis2/Axis2ServiceServlet.java | 211 +++ .../tuscany/binding/axis2/Axis2TargetInvoker.java | 186 +++ .../tuscany/binding/axis2/TuscanyDispatcher.java | 79 ++ .../binding/axis2/WebServiceBindingDefinition.java | 210 +++ .../binding/axis2/WebServiceBindingLoader.java | 244 ++++ .../axis2/util/TuscanyAxisConfigurator.java | 44 + .../axis2/util/WebServiceOperationMetaData.java | 491 +++++++ .../binding/axis2/util/WebServicePortMetaData.java | 377 ++++++ .../main/resources/META-INF/sca/binding.axis2.scdl | 48 + .../src/main/resources/META-INF/sca/default.scdl | 49 + .../resources/META-INF/sca/extension.composite | 22 + .../tuscany/binding/axis2/engine/config/axis2.xml | 306 +++++ .../binding/axis2/Axis2BindingBuilderTestCase.java | 229 ++++ .../binding/axis2/Axis2ReferenceTestCase.java | 111 ++ .../binding/axis2/Axis2ServiceTestCase.java | 153 +++ .../org/apache/tuscany/binding/axis2/Greeter.java | 31 + .../tuscany/binding/axis2/GreetingCallback.java | 24 + .../axis2/WebServicebindingLoaderTestCase.java | 187 +++ .../test/resources/wsdl/hello_world_doc_lit.wsdl | 151 +++ .../sca/extensions/axis2/databinding/.ruleset | 172 +++ .../sca/extensions/axis2/databinding/LICENSE.txt | 202 +++ .../sca/extensions/axis2/databinding/NOTICE.txt | 14 + .../sca/extensions/axis2/databinding/pom.xml | 78 ++ .../databinding/axiom/AxiomDataBinding.java | 67 + .../databinding/axiom/AxiomExceptionHandler.java | 60 + .../tuscany/databinding/axiom/AxiomHelper.java | 64 + .../databinding/axiom/OMElement2Object.java | 40 + .../databinding/axiom/OMElement2String.java | 62 + .../axiom/OMElement2XMLStreamReader.java | 50 + .../databinding/axiom/OMElementWrapperHandler.java | 70 + .../databinding/axiom/Object2OMElement.java | 55 + .../databinding/axiom/String2OMElement.java | 60 + .../axiom/XMLStreamReader2OMElement.java | 63 + .../resources/META-INF/sca/databinding.axiom.scdl | 57 + .../src/main/resources/META-INF/sca/default.scdl | 56 + .../resources/META-INF/sca/extension.composite | 22 + .../axiom/AxiomExceptionHandlerTestCase.java | 107 ++ .../databinding/axiom/OMElementTestCase.java | 103 ++ .../axis2/databinding/src/test/resources/ipo.xml | 33 + .../axis2/databinding/src/test/resources/ipo.xsd | 118 ++ .../databinding/src/test/resources/order.wsdl | 58 + .../sca/extensions/axis2/itests/old-style/pom.xml | 89 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../main/java/helloworld/HelloWorldService.java | 33 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../src/main/resources/OldStyleReference.composite | 37 + .../src/main/resources/OldStyleService.composite | 35 + .../src/main/resources/wsdl/helloworld.wsdl | 80 ++ .../apache/tuscany/sca/itest/HelloWorldServer.java | 49 + .../apache/tuscany/sca/itest/OldStyleTestCase.java | 65 + .../sca/extensions/axis2/itests/pom.xml | 41 + .../axis2/itests/service-explicit-uri/pom.xml | 89 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../main/java/helloworld/HelloWorldService.java | 33 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../src/main/resources/client.composite | 36 + .../src/main/resources/service.composite | 35 + .../src/main/resources/wsdl/helloworld.wsdl | 80 ++ .../apache/tuscany/sca/itest/HelloWorldServer.java | 49 + .../sca/itest/ServiceExplicitURITestCase.java | 65 + .../axis2/itests/service-relative-uri/pom.xml | 89 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../main/java/helloworld/HelloWorldService.java | 33 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../src/main/resources/client.composite | 36 + .../src/main/resources/service.composite | 35 + .../src/main/resources/wsdl/helloworld.wsdl | 80 ++ .../apache/tuscany/sca/itest/HelloWorldServer.java | 49 + .../sca/itest/ServiceRelativeURITestCase.java | 65 + .../sca/extensions/axis2/itests/simplest/pom.xml | 89 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../main/java/helloworld/HelloWorldService.java | 33 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../simplest/src/main/resources/client.composite | 36 + .../simplest/src/main/resources/service.composite | 35 + .../src/main/resources/wsdl/helloworld.wsdl | 80 ++ .../apache/tuscany/sca/itest/HelloWorldServer.java | 49 + .../apache/tuscany/sca/itest/SimplestTestCase.java | 65 + .../extensions/axis2/itests/wsdl-binidng/pom.xml | 90 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../main/java/helloworld/HelloWorldService.java | 33 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../src/main/resources/client.composite | 37 + .../src/main/resources/service.composite | 35 + .../src/main/resources/wsdl/helloworld.wsdl | 80 ++ .../apache/tuscany/sca/itest/HelloWorldServer.java | 49 + .../sca/itest/WsdlElementBindingTestCase.java | 67 + .../extensions/axis2/plugins/java2wsdl/LICENSE.txt | 1407 ++++++++++++++++++++ .../extensions/axis2/plugins/java2wsdl/NOTICE.txt | 14 + .../sca/extensions/axis2/plugins/java2wsdl/pom.xml | 46 + .../java2wsdl/plugin/Java2WSDLGeneratorMojo.java | 153 +++ .../sca/extensions/axis2/plugins/pom.xml | 39 + .../extensions/axis2/plugins/wsdl2java/LICENSE.txt | 1407 ++++++++++++++++++++ .../extensions/axis2/plugins/wsdl2java/NOTICE.txt | 14 + .../sca/extensions/axis2/plugins/wsdl2java/pom.xml | 46 + .../wsdl2java/plugin/WSDL2JavaGeneratorMojo.java | 152 +++ .../tools/wsdl2java/plugin/WSDLFileOption.java | 92 ++ .../sca/extensions/axis2/pom.xml | 181 +++ .../axis2/samples/calculator-ws/LICENSE.txt | 202 +++ .../axis2/samples/calculator-ws/NOTICE.txt | 14 + .../extensions/axis2/samples/calculator-ws/pom.xml | 76 ++ .../axis2/samples/calculator-ws/readme.html | 103 ++ .../src/main/resources/calculator.wsdl | 58 + .../src/main/webapp/WEB-INF/default.scdl | 35 + .../calculator-ws/src/main/webapp/WEB-INF/web.xml | 22 + .../samples/calculator-ws/src/main/webapp/calc.jsp | 43 + .../calculator-ws/src/main/webapp/index.html | 5 + .../axis2/samples/helloworld-async-ws/.ruleset | 172 +++ .../axis2/samples/helloworld-async-ws/pom.xml | 76 ++ .../axis2/samples/helloworld-async-ws/readme.htm | 66 + .../axis2/samples/helloworld-async-ws/setup.bat | 16 + .../main/java/helloworld/HelloWorldCallback.java | 27 + .../src/main/java/helloworld/HelloWorldImpl.java | 63 + .../main/java/helloworld/HelloWorldService.java | 43 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/wsdl/helloworld.wsdl | 180 +++ .../src/main/webapp/META-INF/sca/default.scdl | 48 + .../webapp/META-INF/tuscany/binding.axis2.scdl | 44 + .../webapp/META-INF/tuscany/databinding.axiom.scdl | 51 + .../webapp/META-INF/tuscany/databinding.sdo.scdl | 60 + .../webapp/META-INF/tuscany/interface.wsdl.scdl | 44 + .../src/main/webapp/META-INF/tuscany/webapp.scdl | 149 +++ .../src/main/webapp/WEB-INF/web.xml | 51 + .../samples/helloworld-async-wsclient/pom.xml | 80 ++ .../samples/helloworld-async-wsclient/run.bat | 53 + .../helloworld-async-wsclient/run_celtix.bat | 16 + .../main/java/helloworld/HelloWorldCallback.java | 27 + .../src/main/java/helloworld/HelloWorldClient.java | 40 + .../src/main/java/helloworld/HelloWorldLocal.java | 33 + .../main/java/helloworld/HelloWorldService.java | 38 + .../helloworld/HelloWorldServiceComponent.java | 58 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/META-INF/sca/default.scdl | 46 + .../src/main/resources/logging.properties | 29 + .../src/main/resources/wsdl/helloworld.wsdl | 152 +++ .../java/helloworld/HelloWorldWSAsyncClient.java | 46 + .../META-INF/tuscany/test-extensions.scdl | 28 + .../axis2/samples/helloworld-om-ws/pom.xml | 94 ++ .../axis2/samples/helloworld-om-ws/readme.htm | 48 + .../axis2/samples/helloworld-om-ws/setup.bat | 16 + .../main/java/helloworld/om/HelloWorldImpl.java | 45 + .../main/java/helloworld/om/HelloWorldServer.java | 28 + .../main/java/helloworld/om/HelloWorldService.java | 36 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/helloworldws-om.composite | 34 + .../src/main/resources/wsdl/helloworld-om.wsdl | 78 ++ .../helloworld/om/HelloWorldServerTestCase.java | 44 + .../axis2/samples/helloworld-om-wsclient/pom.xml | 95 ++ .../axis2/samples/helloworld-om-wsclient/run.bat | 53 + .../main/java/helloworld/om/HelloWorldClient.java | 84 ++ .../main/java/helloworld/om/HelloWorldService.java | 34 + .../helloworld/om/HelloWorldServiceComponent.java | 47 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../main/resources/helloworldwsclient-om.composite | 34 + .../src/main/resources/logging.properties | 27 + .../src/main/resources/wsdl/helloworld-om.wsdl | 78 ++ .../helloworld/om/HelloWorldClientTestCase.java | 72 + .../java/helloworld/om/HelloWorldServerTest.java | 44 + .../axis2/samples/helloworld-oneway-ws/pom.xml | 136 ++ .../src/main/java/greeter/GreeterImpl.java | 31 + .../src/main/java/greeter/GreeterService.java | 31 + .../src/main/resources/wsdl/greeter.wsdl | 64 + .../src/main/webapp/META-INF/sca/default.scdl | 40 + .../webapp/META-INF/tuscany/binding.axis2.scdl | 44 + .../webapp/META-INF/tuscany/databinding.axiom.scdl | 51 + .../webapp/META-INF/tuscany/databinding.sdo.scdl | 60 + .../webapp/META-INF/tuscany/interface.wsdl.scdl | 44 + .../src/main/webapp/META-INF/tuscany/webapp.scdl | 148 ++ .../src/main/webapp/WEB-INF/web.xml | 51 + .../samples/helloworld-oneway-wsclient/pom.xml | 96 ++ .../src/main/java/greeter/GreeterClient.java | 36 + .../src/main/java/greeter/GreeterImpl.java | 37 + .../src/main/java/greeter/GreeterLocal.java | 24 + .../src/main/java/greeter/GreeterService.java | 30 + .../src/main/resources/META-INF/sca/default.scdl | 42 + .../src/main/resources/wsdl/greeter.wsdl | 64 + .../test/java/greeter/GreeterWSOneWayClient.java | 58 + .../META-INF/tuscany/test-extensions.scdl | 28 + .../extensions/axis2/samples/helloworld-ws/pom.xml | 83 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../src/main/java/helloworld/HelloWorldServer.java | 28 + .../main/java/helloworld/HelloWorldService.java | 33 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/helloworldws.composite | 33 + .../src/main/resources/system.composite | 36 + .../src/main/resources/wsdl/helloworld.wsdl | 79 ++ .../java/helloworld/HelloWorldServerTestCase.java | 48 + .../axis2/samples/helloworld-wsclient/pom.xml | 87 ++ .../src/main/java/helloworld/HelloWorldClient.java | 41 + .../main/java/helloworld/HelloWorldService.java | 28 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../main/resources/helloworldwsclient.composite | 37 + .../src/main/resources/logging.properties | 30 + .../src/main/resources/wsdl/helloworld.wsdl | 79 ++ .../java/helloworld/HelloWorldClientTestCase.java | 65 + .../test/java/helloworld/HelloWorldServerTest.java | 46 + .../axis2/samples/loanapplication-ws/pom.xml | 85 ++ .../java/loanappconversation/LoanApplication.java | 35 + .../main/java/loanappconversation/LoanService.java | 40 + .../java/loanappconversation/LoanServiceImpl.java | 69 + .../main/resources/wsdl/loanappconversation.wsdl | 271 ++++ .../src/main/webapp/WEB-INF/default.scdl | 41 + .../src/main/webapp/WEB-INF/web.xml | 51 + .../axis2/samples/loanapplication-wsclient/pom.xml | 85 ++ .../LoanAppConversationClient.java | 57 + .../java/loanappconversation/LoanApplication.java | 35 + .../main/java/loanappconversation/LoanClient.java | 30 + .../java/loanappconversation/LoanClientImpl.java | 63 + .../main/java/loanappconversation/LoanService.java | 40 + .../src/main/resources/META-INF/sca/default.scdl | 40 + .../main/resources/wsdl/loanappconversation.wsdl | 271 ++++ .../LoanAppConversationTestCase.java | 63 + .../sca/extensions/axis2/samples/pom.xml | 121 ++ .../sca/extensions/axis2/tools/java2wsdl/pom.xml | 164 +++ .../java2wsdl/generate/GenerationParameters.java | 435 ++++++ .../tools/java2wsdl/generate/Java2WSDL.java | 81 ++ .../java2wsdl/generate/Java2WSDLGenerator.java | 46 + .../generate/Java2WSDLGeneratorFactory.java | 89 ++ .../java2wsdl/generate/Java2WSDLGeneratorImpl.java | 239 ++++ .../tools/java2wsdl/generate/SchemaBuilder.java | 524 ++++++++ .../java2wsdl/generate/TuscanyJava2OMBuilder.java | 521 ++++++++ .../generate/TuscanyJava2WSDLBuilder.java | 81 ++ .../generate/TuscanyJava2WSDLConstants.java | 51 + .../generate/TuscanyJava2WSDLOptionsValidator.java | 74 + .../java2wsdl/generate/TuscanySchemaGenerator.java | 410 ++++++ .../tools/java2wsdl/generate/TuscanyTypeTable.java | 225 ++++ .../generate/TuscanyWSDLTypesGenerator.java | 373 ++++++ .../tools/java2wsdl/generate/WSDLGenEvent.java | 38 + .../tools/java2wsdl/generate/WSDLGenListener.java | 39 + .../tuscany/tools/java2wsdl/util/XMLNameUtil.java | 143 ++ .../wsdl2java/generate/JavaInterfaceEmitter.java | 222 +++ .../wsdl2java/generate/JavaInterfaceGenerator.java | 230 ++++ .../generate/RemotableInterfaceWritter.java | 53 + .../generate/SDODataBindingCodegenExtension.java | 63 + .../generate/SDODataBindingTypeMappingEntry.java | 51 + .../wsdl2java/generate/WSDL2JavaGenerator.java | 349 +++++ .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../java2wsdl/src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../main/resources/RemotableInterfaceTemplate.xsl | 116 ++ .../tools/java2wsdl/generate/CustomerValue.java | 43 + .../java2wsdl/generate/CustomerWithAccount.java | 49 + .../generate/TuscanyJava2WSDLTestCase.java | 108 ++ .../tools/java2wsdl/generate/account/Account.java | 53 + .../java2wsdl/generate/customer/Customer.java | 30 + .../java2wsdl/generate/extra/GoldCustomer.java | 36 + .../generate/WSDL2JavaGeneratorTestCase.java | 44 + .../java/org/soapinterop/CreditScoreDocLit.java | 25 + .../src/test/resources/AccountService.wsdl | 242 ++++ .../src/test/resources/CreditScoreDocLit.wsdl | 76 ++ .../java2wsdl/src/test/resources/helloworld.wsdl | 121 ++ .../java2wsdl/src/test/resources/interopdoc.wsdl | 180 +++ .../java2wsdl/src/test/resources/sequences.xsd | 100 ++ .../sca/extensions/axis2/tools/pom.xml | 131 ++ .../sca/extensions/axis2/tools/wsdl2java/pom.xml | 164 +++ .../java2wsdl/generate/GenerationParameters.java | 435 ++++++ .../tools/java2wsdl/generate/Java2WSDL.java | 81 ++ .../java2wsdl/generate/Java2WSDLGenerator.java | 46 + .../generate/Java2WSDLGeneratorFactory.java | 89 ++ .../java2wsdl/generate/Java2WSDLGeneratorImpl.java | 239 ++++ .../tools/java2wsdl/generate/SchemaBuilder.java | 524 ++++++++ .../java2wsdl/generate/TuscanyJava2OMBuilder.java | 521 ++++++++ .../generate/TuscanyJava2WSDLBuilder.java | 81 ++ .../generate/TuscanyJava2WSDLConstants.java | 51 + .../generate/TuscanyJava2WSDLOptionsValidator.java | 74 + .../java2wsdl/generate/TuscanySchemaGenerator.java | 410 ++++++ .../tools/java2wsdl/generate/TuscanyTypeTable.java | 225 ++++ .../generate/TuscanyWSDLTypesGenerator.java | 373 ++++++ .../tools/java2wsdl/generate/WSDLGenEvent.java | 38 + .../tools/java2wsdl/generate/WSDLGenListener.java | 39 + .../tuscany/tools/java2wsdl/util/XMLNameUtil.java | 143 ++ .../wsdl2java/generate/JavaInterfaceEmitter.java | 222 +++ .../wsdl2java/generate/JavaInterfaceGenerator.java | 230 ++++ .../generate/RemotableInterfaceWritter.java | 53 + .../generate/SDODataBindingCodegenExtension.java | 63 + .../generate/SDODataBindingTypeMappingEntry.java | 51 + .../wsdl2java/generate/WSDL2JavaGenerator.java | 357 +++++ .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../wsdl2java/src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../main/resources/RemotableInterfaceTemplate.xsl | 116 ++ .../tools/java2wsdl/generate/CustomerValue.java | 43 + .../java2wsdl/generate/CustomerWithAccount.java | 49 + .../generate/TuscanyJava2WSDLTestCase.java | 108 ++ .../tools/java2wsdl/generate/account/Account.java | 53 + .../java2wsdl/generate/customer/Customer.java | 30 + .../java2wsdl/generate/extra/GoldCustomer.java | 36 + .../generate/WSDL2JavaGeneratorTestCase.java | 65 + .../java/org/soapinterop/CreditScoreDocLit.java | 25 + .../src/test/resources/AccountService.wsdl | 242 ++++ .../src/test/resources/CreditScoreDocLit.wsdl | 76 ++ .../wsdl2java/src/test/resources/helloworld.wsdl | 121 ++ .../wsdl2java/src/test/resources/interopdoc.wsdl | 180 +++ .../wsdl2java/src/test/resources/sequences.xsd | 100 ++ .../sca/extensions/jms/binding/LICENSE.txt | 202 +++ .../sca/extensions/jms/binding/NOTICE.txt | 14 + .../sca/extensions/jms/binding/pom.xml | 91 ++ .../jms/DefaultOperationAndDataBinding.java | 162 +++ .../tuscany/binding/jms/JMSBindingBuilder.java | 177 +++ .../tuscany/binding/jms/JMSBindingDefinition.java | 274 ++++ .../tuscany/binding/jms/JMSBindingException.java | 40 + .../tuscany/binding/jms/JMSBindingLoader.java | 199 +++ .../org/apache/tuscany/binding/jms/JMSProxy.java | 131 ++ .../tuscany/binding/jms/JMSReferenceBinding.java | 75 ++ .../tuscany/binding/jms/JMSResourceFactory.java | 38 + .../tuscany/binding/jms/JMSServiceBinding.java | 100 ++ .../tuscany/binding/jms/JMSTargetInvoker.java | 119 ++ .../binding/jms/OperationAndDataBinding.java | 49 + .../binding/jms/SimpleJMSResourceFactory.java | 114 ++ .../jms/databinding/AbstractJmsTransformer.java | 98 ++ .../jms/databinding/Input2JmsInputTransformer.java | 69 + .../jms/databinding/JmsInput2InputTransformer.java | 68 + .../databinding/JmsOutput2OutputTransformer.java | 72 + .../databinding/Output2JmsOutputTransformer.java | 71 + .../main/resources/META-INF/sca/binding.jms.scdl | 52 + .../src/main/resources/META-INF/sca/default.scdl | 52 + .../resources/META-INF/sca/extension.composite | 22 + .../tuscany/binding/jms/GreetingService.java | 26 + .../tuscany/binding/jms/GreetingServiceImpl.java | 27 + .../tuscany/binding/jms/HelloworldService.java | 26 + .../tuscany/binding/jms/HelloworldServiceImpl.java | 27 + .../apache/tuscany/binding/jms/IntroService.java | 23 + .../tuscany/binding/jms/IntroServiceImpl.java | 36 + .../binding/jms/JMSBindingLoaderTestCase.java | 91 ++ .../tuscany/binding/jms/JMSBindingTestCaseX.java | 111 ++ .../tuscany/binding/jms/JMSProxyTestCase.java | 89 ++ .../jms/databinding/JmsTransformerTestCase.java | 64 + .../src/test/resources/META-INF/sca/default.scdl | 61 + .../src/test/resources/wsdl/helloworld.wsdl | 130 ++ .../sca/extensions/jms/pom.xml | 66 + .../jms/samples/helloworld.jmsReference/pom.xml | 77 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 47 + .../main/java/helloworld/HelloWorldService.java | 30 + .../src/main/resources/META-INF/sca/default.scdl | 36 + .../test/java/helloworld/HelloWorldJmsClient.java | 57 + .../jms/samples/helloworld.jmsService/pom.xml | 76 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 35 + .../main/java/helloworld/HelloWorldService.java | 30 + .../src/main/resources/META-INF/sca/default.scdl | 36 + .../test/java/helloworld/HelloWorldJmsServer.java | 79 ++ .../sca/extensions/jms/samples/pom.xml | 97 ++ .../sca/extensions/jsonrpc/binding/.ruleset | 190 +++ .../sca/extensions/jsonrpc/binding/LICENSE.txt | 202 +++ .../sca/extensions/jsonrpc/binding/pom.xml | 71 + .../binding/jsonrpc/JSONRPCBindingBuilder.java | 66 + .../binding/jsonrpc/JSONRPCBindingDefinition.java | 38 + .../binding/jsonrpc/JSONRPCBindingLoader.java | 57 + .../binding/jsonrpc/JSONRPCEntryPointServlet.java | 141 ++ .../binding/jsonrpc/JSONRPCServiceBinding.java | 94 ++ .../binding/jsonrpc/ScriptGetterServlet.java | 52 + .../tuscany/binding/jsonrpc/util/JavaToSmd.java | 49 + .../resources/META-INF/sca/binding.jsonrpc.scdl | 42 + .../src/main/resources/META-INF/sca/default.scdl | 43 + .../resources/META-INF/sca/extension.composite | 22 + .../org/apache/tuscany/binding/jsonrpc/jsonrpc.js | 484 +++++++ .../jsonrpc/JSONRPCBindingBuilderTestCase.java | 70 + .../jsonrpc/JSONRPCBindingLoaderTestCase.java | 81 ++ .../binding/jsonrpc/JSONRPCBindingTestCase.java | 37 + .../jsonrpc/JSONRPCEntryPointServletTestCase.java | 186 +++ .../binding/jsonrpc/JSONRPCServiceTestCase.java | 100 ++ .../jsonrpc/ScriptGetterServletTestCase.java | 57 + .../tuscany/binding/jsonrpc/TestInterface.java | 25 + .../binding/jsonrpc/util/JavaToSmdTestCase.java | 62 + .../sca/extensions/jsonrpc/pom.xml | 66 + .../extensions/jsonrpc/samples/helloworld/.ruleset | 190 +++ .../jsonrpc/samples/helloworld/build.xml | 81 ++ .../extensions/jsonrpc/samples/helloworld/pom.xml | 116 ++ .../java/helloworldjsonrpc/HelloWorldService.java | 28 + .../helloworldjsonrpc/HelloWorldServiceImpl.java | 36 + .../src/main/webapp/HelloWorldJSONRPC.html | 136 ++ .../src/main/webapp/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../helloworld/src/main/webapp/META-INF/NOTICE | 18 + .../src/main/webapp/WEB-INF/default.scdl | 32 + .../helloworld/src/main/webapp/WEB-INF/web.xml | 50 + .../samples/helloworld/src/main/webapp/style.css | 4 + .../sca/extensions/jsonrpc/samples/pom.xml | 96 ++ .../sca-java-integration/sca/extensions/pom.xml | 159 +++ .../sca/extensions/script/container.bsf/.ruleset | 190 +++ .../extensions/script/container.bsf/LICENSE.txt | 202 +++ .../sca/extensions/script/container.bsf/NOTICE.txt | 14 + .../sca/extensions/script/container.bsf/pom.xml | 96 ++ .../tuscany/container/script/ScriptComponent.java | 135 ++ .../container/script/ScriptComponentBuilder.java | 97 ++ .../container/script/ScriptComponentType.java | 47 + .../script/ScriptComponentTypeLoader.java | 76 ++ .../container/script/ScriptImplementation.java | 74 + .../ScriptImplementationJavaScriptLoader.java | 43 + .../script/ScriptImplementationLoader.java | 120 ++ .../script/ScriptImplementationPythonLoader.java | 78 ++ .../script/ScriptImplementationRubyLoader.java | 43 + .../tuscany/container/script/ScriptInstance.java | 51 + .../container/script/ScriptInstanceFactory.java | 151 +++ .../container/script/ScriptTargetInvoker.java | 56 + .../src/main/resources/META-INF/sca/default.scdl | 40 + .../resources/META-INF/sca/extension.composite | 22 + .../main/resources/META-INF/sca/script.system.scdl | 52 + .../script/ScriptComponentBuilderTestCase.java | 117 ++ .../container/script/ScriptComponentTestCase.java | 88 ++ .../script/ScriptComponentTypeLoaderTestCase.java | 113 ++ .../script/ScriptComponentTypeTestCase.java | 32 + .../ScriptImplementationLoaderLoadingTestCase.java | 78 ++ .../script/ScriptImplementationLoaderTestCase.java | 133 ++ .../script/ScriptImplementationTestCase.java | 35 + .../script/ScriptInstanceFactoryTestCase.java | 106 ++ .../container/script/ScriptInstanceTestCase.java | 46 + .../container/script/ScriptInvokerTestCase.java | 78 ++ .../container/script/mock/MockBSFEngine.java | 30 + .../tuscany/container/script/foo.componentType | 9 + .../org/apache/tuscany/container/script/foo.mock | 1 + .../container/script/helper/foo.componentType | 9 + .../tuscany/container/script/helper/foo.mock | 1 + .../extensions/script/databinding.e4x/LICENSE.txt | 202 +++ .../extensions/script/databinding.e4x/NOTICE.txt | 14 + .../sca/extensions/script/databinding.e4x/pom.xml | 124 ++ .../script/databinding/e4x/E4X2OMElement.java | 49 + .../script/databinding/e4x/E4X2Object.java | 46 + .../script/databinding/e4x/E4XDataBinding.java | 57 + .../script/databinding/e4x/E4XWrapperHandler.java | 76 ++ .../script/databinding/e4x/OMElement2E4X.java | 70 + .../script/databinding/e4x/Object2E4X.java | 57 + .../resources/META-INF/sca/databinding.e4x.scdl | 50 + .../src/main/resources/META-INF/sca/default.scdl | 50 + .../resources/META-INF/sca/extension.composite | 22 + .../sca/extensions/script/itests/pom.xml | 138 ++ .../main/java/calculator/CalculatorService.java | 32 + .../src/main/java/calculator/DivideService.java | 24 + .../main/java/helloworld/HelloWorldService.java | 33 + .../resources/META-INF/sca/helloworld.composite | 40 + .../resources/META-INF/sca/properties.composite | 79 ++ .../resources/META-INF/sca/references.composite | 43 + .../src/main/resources/META-INF/sca/xml.composite | 44 + .../calculator/CalculatorImpl.componentType | 31 + .../main/resources/calculator/CalculatorImpl.py | 56 + .../main/resources/calculator/CalculatorImpl.rb | 48 + .../resources/calculator/DivideImpl.componentType | 30 + .../src/main/resources/calculator/DivideImpl.py | 65 + .../src/main/resources/calculator/DivideImpl.rb | 39 + .../calculator/sample.calculator.composite | 45 + .../resources/helloworld/helloworld.componentType | 27 + .../main/resources/helloworld/helloworld.groovy | 22 + .../src/main/resources/helloworld/helloworld.js | 22 + .../src/main/resources/helloworld/helloworld.py | 19 + .../src/main/resources/helloworld/helloworld.rb | 21 + .../resources/properties/helloworld.componentType | 29 + .../src/main/resources/properties/helloworld.js | 22 + .../src/main/resources/properties/helloworld.py | 19 + .../src/main/resources/properties/helloworld.rb | 21 + .../properties/helloworldDyn.componentType | 27 + .../src/main/resources/properties/helloworldDyn.js | 24 + .../src/main/resources/properties/helloworldDyn.py | 21 + .../src/main/resources/properties/helloworldDyn.rb | 23 + .../references/helloworldProxy.componentType | 31 + .../main/resources/references/helloworldProxy.js | 22 + .../main/resources/references/helloworldProxy.py | 19 + .../main/resources/references/helloworldProxy.rb | 21 + .../itests/src/main/resources/wsdl/helloworld.wsdl | 80 ++ .../main/resources/xml/helloworld.componentType | 31 + .../itests/src/main/resources/xml/helloworld.js | 23 + .../main/resources/xml/helloworldXML.componentType | 27 + .../itests/src/main/resources/xml/helloworldXML.js | 29 + .../resources/xml/helloworldXMLProxy.componentType | 31 + .../src/main/resources/xml/helloworldXMLProxy.js | 27 + .../java/calculator/CalculatorClientTestCase.java | 59 + .../java/helloworld/HelloWorldClientTestCase.java | 72 + .../helloworld/JavaScriptPropertiesTestCase.java | 75 ++ .../java/helloworld/PythonPropertiesTestCase.java | 74 + .../test/java/helloworld/ReferencesTestCase.java | 68 + .../java/helloworld/RubyPropertiesTestCase.java | 73 + .../src/test/java/helloworld/XMLTestCase.java | 61 + .../sca/extensions/script/pom.xml | 40 + .../sca/kernel/api/.checkstyle | 24 + .../sca-java-integration/sca/kernel/api/.pmd | 20 + .../sca-java-integration/sca/kernel/api/.ruleset | 190 +++ .../sca/kernel/api/LICENSE.txt | 202 +++ .../sca-java-integration/sca/kernel/api/NOTICE.txt | 14 + .../sca-java-integration/sca/kernel/api/pom.xml | 42 + .../java/org/apache/tuscany/api/SCARuntime.java | 251 ++++ .../org/apache/tuscany/api/TuscanyException.java | 164 +++ .../tuscany/api/TuscanyRuntimeException.java | 168 +++ .../apache/tuscany/api/annotation/DataType.java | 45 + .../apache/tuscany/api/annotation/IDLMapping.java | 51 + .../apache/tuscany/api/annotation/LogLevel.java | 40 + .../org/apache/tuscany/api/annotation/Monitor.java | 34 + .../apache/tuscany/api/annotation/Resource.java | 49 + .../tuscany/api/TuscanyExceptionTestCase.java | 164 +++ .../api/TuscanyRuntimeExceptionTestCase.java | 142 ++ .../sca/kernel/core/.checkstyle | 6 + .../sca-java-integration/sca/kernel/core/.pmd | 2 + .../sca-java-integration/sca/kernel/core/.ruleset | 190 +++ .../sca/kernel/core/LICENSE.txt | 202 +++ .../sca/kernel/core/NOTICE.txt | 14 + .../sca-java-integration/sca/kernel/core/pom.xml | 96 ++ .../binding/local/AbstractLocalTargetInvoker.java | 77 ++ .../core/binding/local/LocalBindingBuilder.java | 56 + .../core/binding/local/LocalBindingDefinition.java | 45 + .../core/binding/local/LocalBindingLoader.java | 70 + .../binding/local/LocalCallbackTargetInvoker.java | 74 + .../core/binding/local/LocalReferenceBinding.java | 61 + .../core/binding/local/LocalServiceBinding.java | 55 + .../core/binding/local/LocalTargetInvoker.java | 73 + .../tuscany/core/bootstrap/Bootstrapper.java | 88 ++ .../core/bootstrap/DefaultBootstrapper.java | 262 ++++ .../tuscany/core/bootstrap/DefaultRuntime.java | 83 ++ .../tuscany/core/bootstrap/DefaultSCARuntime.java | 92 ++ .../tuscany/core/builder/BuilderRegistryImpl.java | 293 ++++ .../apache/tuscany/core/builder/ConnectorImpl.java | 627 +++++++++ .../core/builder/IllegalCallbackException.java | 54 + .../builder/IncompatibleInterfacesException.java | 93 ++ .../core/builder/InvalidTargetTypeException.java | 41 + .../builder/NoCompatibleBindingsException.java | 36 + .../builder/NoConversationalContractException.java | 37 + .../core/builder/NoRegisteredBuilderException.java | 38 + .../builder/TargetServiceNotFoundException.java | 42 + .../tuscany/core/builder/WireConnectException.java | 58 + .../builder/WirePostProcessorRegistryImpl.java | 57 + .../core/builder/WiringExceptionFormatter.java | 72 + .../core/component/ComponentContextImpl.java | 85 ++ .../tuscany/core/component/ScopeIdentifier.java | 35 + .../tuscany/core/component/WorkContextImpl.java | 211 +++ .../core/component/event/AbstractEvent.java | 39 + .../core/component/event/AbstractRequestEvent.java | 38 + .../core/component/event/CompositeEvent.java | 33 + .../core/component/event/CompositeStart.java | 47 + .../core/component/event/CompositeStop.java | 46 + .../core/component/event/ConversationEnd.java | 31 + .../core/component/event/ConversationStart.java | 31 + .../core/component/event/ConversationalEvent.java | 39 + .../core/component/event/HttpRequestEnded.java | 38 + .../core/component/event/HttpRequestStart.java | 38 + .../core/component/event/HttpSessionEnd.java | 38 + .../core/component/event/HttpSessionEvent.java | 45 + .../core/component/event/HttpSessionStart.java | 38 + .../tuscany/core/component/event/RequestEnd.java | 38 + .../tuscany/core/component/event/RequestEvent.java | 28 + .../tuscany/core/component/event/RequestStart.java | 37 + .../component/scope/AbstractScopeContainer.java | 158 +++ .../component/scope/CompositeScopeContainer.java | 189 +++ .../scope/CompositeScopeObjectFactory.java | 50 + .../scope/ConversationalScopeContainer.java | 217 +++ .../scope/ConversationalScopeObjectFactory.java | 58 + .../component/scope/HttpSessionScopeContainer.java | 135 ++ .../scope/HttpSessionScopeObjectFactory.java | 54 + .../core/component/scope/InstanceWrapper.java | 41 + .../core/component/scope/InstanceWrapperImpl.java | 63 + .../component/scope/RequestScopeContainer.java | 126 ++ .../component/scope/RequestScopeObjectFactory.java | 47 + .../core/component/scope/ScopeRegistryImpl.java | 63 + .../component/scope/StatelessScopeContainer.java | 75 ++ .../scope/StatelessScopeObjectFactory.java | 54 + .../databinding/impl/DataBindingInteceptor.java | 250 ++++ .../impl/DataBindingJavaInterfaceProcessor.java | 126 ++ .../databinding/impl/DataBindingRegistryImpl.java | 121 ++ .../impl/DataBindingWirePostProcessor.java | 157 +++ .../core/databinding/impl/DataTypeLoader.java | 67 + .../core/databinding/impl/DirectedGraph.java | 357 +++++ .../impl/Exception2ExceptionTransformer.java | 126 ++ .../databinding/impl/Group2GroupTransformer.java | 97 ++ .../core/databinding/impl/GroupDataBinding.java | 97 ++ .../databinding/impl/Input2InputTransformer.java | 201 +++ .../core/databinding/impl/MediatorImpl.java | 185 +++ .../databinding/impl/Output2OutputTransformer.java | 186 +++ .../databinding/impl/PassByValueInterceptor.java | 131 ++ .../impl/PassByValueWirePostProcessor.java | 188 +++ .../core/databinding/impl/PipedTransformer.java | 66 + .../core/databinding/impl/SimpleDataBinding.java | 61 + .../impl/TransformationContextImpl.java | 83 ++ .../databinding/impl/TransformerRegistryImpl.java | 101 ++ .../javabeans/DOMNode2JavaBeanTransformer.java | 78 ++ .../javabeans/Java2XMLMapperException.java | 69 + .../javabeans/JavaBean2DOMNodeTransformer.java | 70 + .../javabeans/JavaBean2XMLStreamReader.java | 56 + .../javabeans/JavaBean2XMLTransformer.java | 226 ++++ .../javabeans/JavaBeansDataBinding.java | 107 ++ .../javabeans/XML2JavaBeanTransformer.java | 300 +++++ .../javabeans/XML2JavaMapperException.java | 76 ++ .../tuscany/core/databinding/xml/BeanUtil.java | 196 +++ .../core/databinding/xml/DOMDataBinding.java | 52 + .../core/databinding/xml/DOMWrapperHandler.java | 78 ++ .../core/databinding/xml/DOMXMLStreamReader.java | 129 ++ .../xml/DelegatingNamespaceContext.java | 310 +++++ .../core/databinding/xml/InputSource2Node.java | 65 + .../core/databinding/xml/InputSource2SAX.java | 63 + .../core/databinding/xml/InputStream2Node.java | 67 + .../core/databinding/xml/InputStream2SAX.java | 62 + .../xml/NameValueArrayStreamReader.java | 403 ++++++ .../databinding/xml/NameValuePairStreamReader.java | 347 +++++ .../core/databinding/xml/NamedProperty.java | 59 + .../databinding/xml/NilElementStreamReader.java | 279 ++++ .../core/databinding/xml/Node2OutputStream.java | 66 + .../tuscany/core/databinding/xml/Node2String.java | 59 + .../tuscany/core/databinding/xml/Node2Writer.java | 65 + .../core/databinding/xml/Node2XMLStreamReader.java | 59 + .../tuscany/core/databinding/xml/Reader2Node.java | 65 + .../tuscany/core/databinding/xml/Reader2SAX.java | 58 + .../tuscany/core/databinding/xml/SAX2DOM.java | 244 ++++ .../tuscany/core/databinding/xml/SAX2DOMPipe.java | 67 + .../databinding/xml/Source2ResultTransformer.java | 60 + .../core/databinding/xml/StAX2SAXAdapter.java | 256 ++++ .../core/databinding/xml/StAXDataBinding.java | 52 + .../tuscany/core/databinding/xml/StAXHelper.java | 85 ++ .../core/databinding/xml/StreamDataPipe.java | 57 + .../tuscany/core/databinding/xml/String2Node.java | 60 + .../tuscany/core/databinding/xml/String2SAX.java | 59 + .../databinding/xml/String2XMLStreamReader.java | 55 + .../databinding/xml/WrappingXMLStreamReader.java | 230 ++++ .../databinding/xml/Writer2ReaderDataPipe.java | 56 + .../databinding/xml/XMLDocumentStreamReader.java | 432 ++++++ .../databinding/xml/XMLFragmentStreamReader.java | 53 + .../xml/XMLFragmentStreamReaderImpl.java | 857 ++++++++++++ .../core/databinding/xml/XMLGroupDataBinding.java | 58 + .../core/databinding/xml/XMLStreamReader2Node.java | 62 + .../core/databinding/xml/XMLStreamReader2SAX.java | 73 + .../databinding/xml/XMLStreamReader2String.java | 55 + .../core/databinding/xml/XMLStreamSerializer.java | 266 ++++ .../core/databinding/xml/XMLStreamable.java | 37 + .../core/databinding/xml/XMLStringDataBinding.java | 51 + .../core/deployer/AbstractDeploymentContext.java | 61 + .../core/deployer/ChildDeploymentContext.java | 60 + .../apache/tuscany/core/deployer/DeployerImpl.java | 176 +++ .../core/deployer/RootDeploymentContext.java | 65 + .../deployer/federation/FederatedDeployer.java | 109 ++ .../core/idl/java/IllegalCallbackException.java | 34 + .../tuscany/core/idl/java/InterfaceJavaLoader.java | 117 ++ .../java/JavaInterfaceProcessorRegistryImpl.java | 169 +++ .../implementation/IntrospectionRegistryImpl.java | 135 ++ .../core/implementation/PojoAtomicComponent.java | 282 ++++ .../core/implementation/PojoConfiguration.java | 232 ++++ .../composite/AbstractCompositeBuilder.java | 61 + .../composite/AbstractCompositeComponent.java | 151 +++ .../composite/AbstractCompositeContext.java | 124 ++ .../composite/ComponentTimeoutException.java | 33 + .../implementation/composite/CompositeBuilder.java | 50 + .../composite/CompositeComponentImpl.java | 114 ++ .../composite/CompositeComponentTypeLoader.java | 67 + .../implementation/composite/CompositeLoader.java | 426 ++++++ .../core/implementation/composite/Dependency.java | 39 + .../composite/ImplementationCompositeLoader.java | 126 ++ .../composite/ManagedRequestContext.java | 58 + .../implementation/composite/ReferenceImpl.java | 90 ++ .../core/implementation/composite/ServiceImpl.java | 98 ++ .../composite/SystemCompositeBuilder.java | 67 + .../composite/SystemSingletonAtomicComponent.java | 164 +++ .../implementation/java/JavaAtomicComponent.java | 100 ++ .../implementation/java/JavaComponentBuilder.java | 208 +++ .../java/JavaComponentTypeLoader.java | 141 ++ .../implementation/java/JavaImplementation.java | 62 + .../java/JavaImplementationLoader.java | 65 + .../implementation/java/JavaTargetInvoker.java | 144 ++ .../processor/AllowsPassByReferenceProcessor.java | 63 + .../processor/AmbiguousConstructorException.java | 41 + .../processor/ConstructorProcessor.java | 112 ++ .../implementation/processor/ContextProcessor.java | 140 ++ .../processor/ConversationProcessor.java | 142 ++ .../implementation/processor/DestroyProcessor.java | 62 + .../processor/DuplicateConstructorException.java | 38 + .../processor/DuplicateDestructorException.java | 37 + .../processor/DuplicateInitException.java | 37 + .../processor/DuplicateReferenceException.java | 38 + .../processor/DuplicateResourceException.java | 37 + .../processor/EagerInitProcessor.java | 59 + .../processor/HeuristicPojoProcessor.java | 550 ++++++++ .../IllegalCallbackReferenceException.java | 37 + .../processor/IllegalContextException.java | 37 + .../processor/IllegalDestructorException.java | 37 + .../processor/IllegalInitException.java | 36 + .../processor/IllegalReferenceException.java | 37 + .../processor/IllegalResourceException.java | 37 + .../IllegalServiceDefinitionException.java | 37 + .../ImplementationProcessorServiceImpl.java | 469 +++++++ .../implementation/processor/InitProcessor.java | 62 + .../processor/InvalidAutowireException.java | 34 + .../processor/InvalidConstructorException.java | 39 + .../InvalidConversationalImplementation.java | 45 + .../processor/InvalidPropertyException.java | 34 + .../processor/InvalidReferenceException.java | 41 + .../processor/InvalidResourceException.java | 33 + .../processor/InvalidServiceType.java | 34 + .../implementation/processor/MonitorProcessor.java | 57 + .../processor/NoConstructorException.java | 36 + .../processor/PropertyProcessor.java | 79 ++ .../processor/ReferenceProcessor.java | 184 +++ .../processor/ResourceProcessor.java | 117 ++ .../implementation/processor/ScopeProcessor.java | 64 + .../implementation/processor/ServiceProcessor.java | 156 +++ .../processor/ServiceTypeNotFoundException.java | 34 + .../processor/UnknownContextTypeException.java | 32 + .../system/builder/SystemComponentBuilder.java | 184 +++ .../component/SystemAtomicComponentImpl.java | 55 + .../system/loader/SystemComponentTypeLoader.java | 101 ++ .../loader/SystemCompositeComponentTypeLoader.java | 70 + .../system/loader/SystemImplementationLoader.java | 75 ++ .../model/SystemCompositeImplementation.java | 57 + .../system/model/SystemImplementation.java | 51 + .../injection/ArrayMultiplicityObjectFactory.java | 54 + .../core/injection/CallbackWireObjectFactory.java | 47 + .../injection/CompositeContextObjectFactory.java | 48 + .../tuscany/core/injection/ContextInjector.java | 32 + .../injection/ConversationIDObjectFactory.java | 36 + .../tuscany/core/injection/EventInvoker.java | 34 + .../tuscany/core/injection/FieldInjector.java | 57 + .../core/injection/InjectionRuntimeException.java | 55 + .../apache/tuscany/core/injection/Injector.java | 35 + .../core/injection/InvalidAccessorException.java | 34 + .../injection/InvalidResourceTypeException.java | 33 + .../core/injection/JNDIListObjectFactory.java | 58 + .../tuscany/core/injection/JNDIObjectFactory.java | 50 + .../injection/ListMultiplicityObjectFactory.java | 50 + .../tuscany/core/injection/MethodEventInvoker.java | 55 + .../tuscany/core/injection/MethodInjector.java | 55 + .../core/injection/NoAccessorException.java | 39 + .../injection/NoMultiplicityTypeException.java | 29 + .../core/injection/ObjectCallbackException.java | 48 + .../tuscany/core/injection/PojoObjectFactory.java | 123 ++ .../injection/RequestContextObjectFactory.java | 26 + .../core/injection/ResourceNotFoundException.java | 34 + .../core/injection/ResourceObjectFactory.java | 146 ++ .../core/injection/SingletonListObjectFactory.java | 42 + .../core/injection/SingletonObjectFactory.java | 39 + .../core/launcher/CompositeContextImpl.java | 60 + .../tuscany/core/launcher/LaunchException.java | 49 + .../apache/tuscany/core/launcher/LauncherImpl.java | 250 ++++ .../tuscany/core/launcher/LauncherRuntimeInfo.java | 96 ++ .../tuscany/core/loader/ComponentLoader.java | 524 ++++++++ .../core/loader/ComponentTypeElementLoader.java | 90 ++ .../DefaultPropertyValueLoaderException.java | 32 + .../tuscany/core/loader/DependencyLoader.java | 88 ++ .../apache/tuscany/core/loader/IncludeLoader.java | 111 ++ .../tuscany/core/loader/JNDIPropertyFactory.java | 71 + .../core/loader/LoaderExceptionFormatter.java | 50 + .../tuscany/core/loader/LoaderRegistryImpl.java | 185 +++ .../loader/ManyPropertyValueLoaderException.java | 32 + .../loader/MissingTypePropertyLoaderException.java | 32 + .../tuscany/core/loader/PolicySetLoader.java | 196 +++ .../apache/tuscany/core/loader/PropertyLoader.java | 170 +++ .../core/loader/PropertyLoaderException.java | 69 + .../tuscany/core/loader/ReferenceLoader.java | 196 +++ .../apache/tuscany/core/loader/ServiceLoader.java | 106 ++ .../core/loader/StringParserPropertyFactory.java | 205 +++ .../org/apache/tuscany/core/loader/WireLoader.java | 112 ++ .../marshaller/ComponentDefinitionMarshaller.java | 80 ++ .../core/monitor/DefaultExceptionFormatter.java | 54 + .../core/monitor/InvalidLevelException.java | 64 + .../core/monitor/JavaLoggingMonitorFactory.java | 321 +++++ .../tuscany/core/monitor/MonitorFactoryUtil.java | 78 ++ .../tuscany/core/monitor/NullMonitorFactory.java | 58 + .../tuscany/core/policy/IntentRegistryImpl.java | 167 +++ .../core/policy/PolicyBuilderRegistryImpl.java | 79 ++ .../tuscany/core/policy/PolicyEngineImpl.java | 297 +++++ .../apache/tuscany/core/policy/PolicyHelper.java | 65 + .../tuscany/core/property/PropertyHelper.java | 235 ++++ .../core/property/PropertyObjectFactoryImpl.java | 147 ++ .../SimpleMultivaluedPropertyObjectFactory.java | 74 + .../core/property/SimplePropertyObjectFactory.java | 64 + .../tuscany/core/runtime/AbstractRuntime.java | 283 ++++ .../tuscany/core/runtime/mini/SimpleRuntime.java | 32 + .../core/runtime/mini/SimpleRuntimeImpl.java | 140 ++ .../core/runtime/mini/SimpleRuntimeInfo.java | 48 + .../core/runtime/mini/SimpleRuntimeInfoImpl.java | 184 +++ .../services/artifact/LocalMavenRepository.java | 100 ++ .../deployment/ArtifactResolverRegistryImpl.java | 70 + .../services/deployment/AssemblyServiceImpl.java | 156 +++ .../deployment/ContentTypeDescriberImpl.java | 111 ++ .../deployment/ContributionDirectoryWatcher.java | 70 + .../services/deployment/ContributionLoader.java | 126 ++ .../ContributionProcessorRegistryImpl.java | 96 ++ .../deployment/ContributionRepositoryImpl.java | 275 ++++ .../deployment/ContributionServiceImpl.java | 232 ++++ .../services/deployment/DomainUpdateException.java | 47 + .../InvalidContributionMetadataException.java | 52 + .../deployment/InvalidDocumentException.java | 38 + .../services/deployment/XMLChangeSetHandler.java | 132 ++ .../CompositeContributionProcessor.java | 102 ++ .../contribution/FolderContributionProcessor.java | 139 ++ .../InvalidComponentDefinitionlException.java | 41 + .../InvalidFolderContributionURIException.java | 41 + .../InvalidPojoComponentDefinitionlException.java | 36 + .../contribution/JarContributionProcessor.java | 146 ++ .../contribution/JavaContributionProcessor.java | 107 ++ .../MetadataContributionProcessor.java | 90 ++ .../ComponentDefinitionArtifactResolver.java | 69 + .../extension/AbstractExtensionDeployer.java | 122 ++ .../host/DelegatingResourceHostRegistry.java | 142 ++ .../core/services/store/memory/MemoryStore.java | 198 +++ .../core/services/work/jca/JcaWorkScheduler.java | 206 +++ .../services/work/jsr237/Jsr237WorkScheduler.java | 217 +++ .../work/jsr237/workmanager/DefaultWorkEvent.java | 73 + .../work/jsr237/workmanager/DefaultWorkItem.java | 166 +++ .../jsr237/workmanager/ThreadPoolWorkManager.java | 220 +++ .../tuscany/core/test/SCATestCaseRunner.java | 213 +++ .../tuscany/core/util/ClassLoaderHelper.java | 93 ++ .../org/apache/tuscany/core/util/FileHelper.java | 704 ++++++++++ .../org/apache/tuscany/core/util/IOHelper.java | 184 +++ .../tuscany/core/util/JavaIntrospectionHelper.java | 439 ++++++ .../tuscany/core/util/ReferenceLoaderHelper.java | 167 +++ .../tuscany/core/wire/BridgingInterceptor.java | 29 + .../core/wire/CallbackInterfaceInterceptor.java | 60 + .../core/wire/InboundInvocationChainImpl.java | 41 + .../apache/tuscany/core/wire/InboundWireImpl.java | 166 +++ ...ompatibleServiceContractExceptionFormatter.java | 95 ++ .../tuscany/core/wire/InvocationChainImpl.java | 107 ++ .../tuscany/core/wire/InvokerInterceptor.java | 59 + .../org/apache/tuscany/core/wire/LoopBackWire.java | 33 + .../core/wire/NoMethodForOperationException.java | 42 + .../core/wire/NonBlockingBridgingInterceptor.java | 177 +++ .../core/wire/OptimizedWireObjectFactory.java | 47 + .../core/wire/OutboundInvocationChainImpl.java | 53 + .../apache/tuscany/core/wire/OutboundWireImpl.java | 176 +++ .../core/wire/SynchronousBridgingInterceptor.java | 55 + .../tuscany/core/wire/WireObjectFactory.java | 84 ++ .../tuscany/core/wire/WireServiceExtension.java | 323 +++++ .../org/apache/tuscany/core/wire/WireUtils.java | 146 ++ .../wire/jdk/JDKCallbackInvocationHandler.java | 137 ++ .../core/wire/jdk/JDKInboundInvocationHandler.java | 173 +++ .../wire/jdk/JDKOutboundInvocationHandler.java | 249 ++++ .../tuscany/core/wire/jdk/JDKWireService.java | 114 ++ .../META-INF/tuscany/default-system.composite | 163 +++ .../org/apache/tuscany/core/composite.scdl | 45 + .../org/apache/tuscany/core/databinding.scdl | 183 +++ .../org/apache/tuscany/core/deployment.scdl | 70 + .../org/apache/tuscany/core/formatters.scdl | 43 + .../org/apache/tuscany/core/implementation.scdl | 78 ++ .../org/apache/tuscany/core/interfaceJava.scdl | 35 + .../apache/tuscany/core/javaImplementation.scdl | 39 + .../resources/org/apache/tuscany/core/loader.scdl | 52 + .../apache/tuscany/core/systemImplementation.scdl | 46 + .../local/AbstractLocalTargetInvokerTestCase.java | 72 + .../binding/local/LocalBindingBuilderTestCase.java | 38 + .../binding/local/LocalBindingLoaderTestCase.java | 70 + ...ckTargetInvokerInvocationExceptionTestCase.java | 86 ++ .../local/LocalCallbackTargetInvokerTestCase.java | 82 ++ ...ocalCallbackTargetInvokerThrowableTestCase.java | 98 ++ .../binding/local/LocalTargetInvokerTestCase.java | 127 ++ .../core/bootstrap/BootstrapperTestCase.java | 42 + .../builder/AbstractConnectorImplTestCase.java | 306 +++++ .../core/builder/AtomicConnectorTestCase.java | 125 ++ .../builder/BuilderRegistryNoBindingsTestCase.java | 80 ++ .../core/builder/BuilderRegistryTestCase.java | 219 +++ .../core/builder/ConnectorImplTestCase.java | 322 +++++ .../core/builder/ConnectorPostProcessTestCase.java | 104 ++ .../builder/IllegalCallbackExceptionTestCase.java | 43 + .../builder/InboundtoOutboundConnectTestCase.java | 168 +++ .../IncompatibleInterfacesExceptionTestCase.java | 41 + .../InvalidTargetTypeExceptionTestCase.java | 41 + .../core/builder/LocalReferenceWiringTestCase.java | 236 ++++ ...rwardNonBlockingCallbackConnectionTestCase.java | 172 +++ ...ckingForwardSyncCallbackConnectionTestCase.java | 171 +++ .../builder/OutboundToInboundConnectTestCase.java | 184 +++ .../core/builder/ReferenceConnectorTestCase.java | 169 +++ .../core/builder/ServiceConnectorTestCase.java | 172 +++ ...nchronousForwardCallbackConnectionTestCase.java | 256 ++++ .../TargetServiceNotFoundExceptionTestCase.java | 41 + .../WirePostProcessorRegistryImplTestCase.java | 63 + .../builder/WiringExceptionFormatterTestCase.java | 88 ++ .../core/component/WorkContextImplTestCase.java | 65 + .../core/component/event/EventTestCase.java | 72 + .../scope/AbstractScopeContainerTestCase.java | 126 ++ .../scope/BasicCompositeScopeTestCase.java | 127 ++ .../scope/BasicConversationalScopeTestCase.java | 129 ++ .../scope/BasicHttpSessionScopeTestCase.java | 145 ++ .../component/scope/BasicRequestScopeTestCase.java | 128 ++ .../scope/BasicStatelessScopeTestCase.java | 120 ++ .../CompositeScopeInitDestroyErrorTestCase.java | 78 ++ .../CompositeScopeInstanceLifecycleTestCase.java | 186 +++ .../scope/CompositeScopeObjectFactoryTestCase.java | 38 + .../scope/CompositeScopeRestartTestCase.java | 99 ++ ...lScopeContainerDestroyOnExpirationTestCase.java | 121 ++ ...ConversationalScopeContainerMaxAgeTestCase.java | 76 ++ ...rsationalScopeContainerMaxIdleTimeTestCase.java | 79 ++ ...rsationalScopeContainerPersistenceTestCase.java | 181 +++ ...nversationalScopeInstanceLifecycleTestCase.java | 70 + .../scope/ConversationalScopeRestartTestCase.java | 112 ++ .../scope/DependencyLifecycleTestCase.java | 170 +++ .../HttpSessionScopeInitDestroyErrorTestCase.java | 69 + .../HttpSessionScopeInstanceLifecycleTestCase.java | 136 ++ .../scope/HttpSessionScopeRestartTestCase.java | 105 ++ .../component/scope/InstanceWrapperTestCase.java | 66 + .../tuscany/core/component/scope/MockFactory.java | 137 ++ .../RequestScopeInitDestroyErrorTestCase.java | 63 + .../RequestScopeInstanceLifecycleTestCase.java | 129 ++ .../scope/RequestScopeRestartTestCase.java | 99 ++ .../component/scope/ScopeRegistryTestCase.java | 80 ++ .../scope/StatelessScopeContainerTestCase.java | 48 + .../scope/StatelessScopeObjectFactoryTestCase.java | 37 + .../core/component/scope/WorkContextTestCase.java | 212 +++ .../impl/DataBindingInterceptorTestCase.java | 132 ++ .../DataBindingJavaInterfaceProcessorTestCase.java | 80 ++ .../impl/DataBindingLoaderTestCase.java | 79 ++ .../impl/DataBindingRegistryImplTestCase.java | 98 ++ .../core/databinding/impl/DataBindingTestCase.java | 45 + ...ndingWirePostProcessorOptimizationTestCase.java | 111 ++ .../impl/DataBindingWirePostProcessorTestCase.java | 231 ++++ .../databinding/impl/DirectedGraphTestCase.java | 89 ++ .../databinding/impl/IDLTransformerTestCase.java | 217 +++ .../databinding/impl/MediatorImplTestCase.java | 118 ++ .../impl/PassByValueInterceptorTestCase.java | 75 ++ .../impl/PassByValueWirePostProcessorTestCase.java | 266 ++++ .../impl/TransformerRegistryImplTestCase.java | 106 ++ .../DOMNode2JavaBeanTransformerTestCase.java | 187 +++ .../JavaBean2DOMNodeTransformerTestCase.java | 127 ++ .../core/databinding/xml/DOM2StAXTestCase.java | 89 ++ .../core/databinding/xml/DataPipeTestCase.java | 89 ++ .../xml/JavaBean2XMLStreamReaderTestCase.java | 133 ++ .../core/databinding/xml/Node2StringTestCase.java | 35 + .../xml/PushTransformationTestCase.java | 81 ++ .../core/databinding/xml/StAXHelperTestCase.java | 47 + .../databinding/xml/TraxTransformerTestCase.java | 99 ++ .../core/deployer/BootstrapDeployerTestCase.java | 168 +++ .../java/ConversationalIntrospectionTestCase.java | 82 ++ ...JavaInterfaceProcessorRegistryImplTestCase.java | 100 ++ .../IntrospectionRegistryTestCase.java | 124 ++ .../PojoAtomicComponentTestCase.java | 159 +++ .../tuscany/core/implementation/TestUtils.java | 74 + .../composite/AutowireResolutionTestCase.java | 87 ++ .../implementation/composite/AutowireTestCase.java | 230 ++++ .../composite/CompositeBuilderTestCase.java | 215 +++ .../CompositeComponentImplBasicTestCase.java | 119 ++ .../CompositeComponentImplSystemWireTestCase.java | 170 +++ .../composite/CompositeComponentImplTestCase.java | 179 +++ .../CompositeComponentResolutionTestCase.java | 84 ++ .../composite/CompositeLifecycleTestCase.java | 120 ++ .../CompositeLoaderWireResolutionTestCase.java | 232 ++++ .../composite/CompositePropagationTestCase.java | 95 ++ .../composite/DuplicateRegistrationTestCase.java | 105 ++ .../ImplementationCompositeLoaderTestCase.java | 194 +++ .../composite/JavaObjectRegistrationTestCase.java | 88 ++ .../composite/ManagedRequestContextTestCase.java | 42 + .../composite/ReferenceImplTestCase.java | 61 + .../composite/ServiceImplTestCase.java | 61 + .../composite/SystemComponentBuilderTestCase.java | 180 +++ .../SystemSingletonAtomicComponentTestCase.java | 61 + ...vaAtomicComponentMetadataInjectionTestCase.java | 37 + ...avaAtomicComponentNegativeMetadataTestCase.java | 49 + .../java/JavaBuilderPropertyTestCase.java | 137 ++ ...JavaComponentBuilderConversationIDTestCase.java | 80 ++ .../java/JavaComponentBuilderMetadataTestCase.java | 112 ++ .../JavaComponentBuilderReferenceTestCase.java | 149 +++ .../java/JavaComponentBuilderResourceTestCase.java | 81 ++ .../java/JavaComponentTypeLoaderTestCase.java | 78 ++ .../java/JavaReferenceWireTestCase.java | 153 +++ .../JavaTargetInvokerBasicInvocationTestCase.java | 188 +++ .../java/JavaTargetInvokerMediationTestCase.java | 61 + ...TargetInvokerNonBlockingInvocationTestCase.java | 229 ++++ .../java/JavaTargetInvokerSequenceTestCase.java | 117 ++ .../JavaTargetInvokerStatelessDestroyTestCase.java | 54 + .../java/JavaTargetInvokerTestCase.java | 53 + .../implementation/java/MultiplicityTestCase.java | 34 + .../java/ResourceInjectionTestCase.java | 111 ++ .../integration/CallbackInvocationTestCase.java | 395 ++++++ .../integration/OutboundWireToJavaTestCase.java | 233 ++++ .../AllowsPassByReferenceProcessorTestCase.java | 59 + .../processor/ConstructorAutowireTestCase.java | 154 +++ .../ConstructorProcessorExtensibilityTestCase.java | 82 ++ .../processor/ConstructorProcessorTestCase.java | 185 +++ .../processor/ConstructorPropertyTestCase.java | 168 +++ .../processor/ConstructorReferenceTestCase.java | 172 +++ .../processor/ConstructorResourceTestCase.java | 166 +++ .../processor/ContextProcessorTestCase.java | 197 +++ .../processor/ConversationProcessorTestCase.java | 151 +++ .../processor/ConvertTimeMillisTestCase.java | 110 ++ .../processor/DestroyProcessorTestCase.java | 100 ++ .../processor/EagerInitProcessorTestCase.java | 54 + .../processor/HeuristicAndPropertyTestCase.java | 70 + .../processor/HeuristicConstructorTestCase.java | 330 +++++ .../processor/HeuristicPojoProcessorTestCase.java | 395 ++++++ .../HeutisticExtensibleConstructorTestCase.java | 129 ++ .../ImplementationProcessorServiceTestCase.java | 117 ++ ...plementationProcessorServiceUniqueTestCase.java | 67 + .../processor/InitProcessorTestCase.java | 98 ++ .../processor/MonitorProcessorTestCase.java | 180 +++ .../processor/PropertyProcessorTestCase.java | 204 +++ .../processor/ReferenceProcessorTestCase.java | 225 ++++ .../processor/ResourceProcessorTestCase.java | 99 ++ .../processor/ScopeProcessorTestCase.java | 128 ++ .../processor/ServiceCallbackTestCase.java | 166 +++ .../processor/ServiceProcessorTestCase.java | 136 ++ .../SystemComponentBuilderResourceTestCase.java | 75 ++ .../component/SystemAtomicComponentTestCase.java | 124 ++ ...ystemAtomicComponentWireInvocationTestCase.java | 60 + .../loader/SystemComponentTypeLoaderTestCase.java | 82 ++ .../loader/SystemImplementationLoaderTestCase.java | 106 ++ .../CallbackWireObjectFactoryTestCase.java | 47 + .../core/injection/FieldInjectorTestCase.java | 48 + .../core/injection/JNDIObjectFactoryTestCase.java | 61 + .../core/injection/MethodEventInvokerTestCase.java | 72 + .../core/injection/MethodInjectorTestCase.java | 79 ++ .../core/injection/PojoObjectFactoryTestCase.java | 64 + .../RequestContextObjectFactoryTestCase.java | 37 + .../injection/ResourceObjectFactoryTestCase.java | 152 +++ .../injection/SingletonObjectFactoryTestCase.java | 33 + .../conversation/AbstractConversationTestCase.java | 62 + .../ConversationIdleExpireTestCase.java | 140 ++ .../ConversationMaxAgeExpireTestCase.java | 141 ++ .../ConversationStartStopEndTestCase.java | 141 ++ .../IntrospectionRegistryIntegrationTestCase.java | 131 ++ .../builder/SystemBuilderPropertyTestCase.java | 89 ++ .../tuscany/core/integration/mock/MockFactory.java | 278 ++++ .../integration/scope/ScopeReferenceTestCase.java | 781 +++++++++++ .../wire/DifferentInterfaceWireTestCase.java | 137 ++ .../wire/ReferenceInjectionTestCase.java | 72 + .../oneway/OneWayWireToJavaInvocationTestCase.java | 130 ++ .../loader/ComponentLoaderNoBindingTestCase.java | 91 ++ .../loader/ComponentLoaderPropertyTestCase.java | 90 ++ .../loader/ComponentLoaderReferenceTestCase.java | 87 ++ .../core/loader/ComponentLoaderTestCase.java | 201 +++ .../loader/ComponentLoaderValidationTestCase.java | 170 +++ .../ComponentReferenceOverridingTestCase.java | 178 +++ .../loader/ComponentTypeElementLoaderTestCase.java | 90 ++ .../core/loader/DependencyLoaderTestCase.java | 124 ++ .../tuscany/core/loader/IncludeLoaderTestCase.java | 169 +++ .../core/loader/JNDIPropertyFactoryTestCase.java | 66 + .../loader/LoaderExceptionFormatterTestCase.java | 47 + .../loader/MultivaluePropertyLoadingTestCase.java | 204 +++ .../core/loader/PolicySetLoaderTestCase.java | 71 + .../core/loader/PropertyLoaderTestCase.java | 180 +++ .../core/loader/PropertyParsingTestCase.java | 78 ++ .../core/loader/ReferenceLoaderTestCase.java | 143 ++ .../tuscany/core/loader/ServiceLoaderTestCase.java | 166 +++ .../loader/StAXLoaderRegistryImplTestCase.java | 131 ++ .../StringParserPropertyFactoryTestCase.java | 133 ++ .../tuscany/core/loader/WireLoaderTestCase.java | 159 +++ .../core/mock/binding/MockServiceBinding.java | 82 ++ .../tuscany/core/mock/component/AsyncTarget.java | 31 + .../core/mock/component/BadContextPojo.java | 28 + .../tuscany/core/mock/component/BadNamePojo.java | 26 + .../core/mock/component/BasicInterface.java | 30 + .../core/mock/component/BasicInterfaceImpl.java | 66 + .../mock/component/CompositeScopeComponent.java | 31 + .../component/CompositeScopeComponentImpl.java | 40 + .../CompositeScopeDestroyOnlyComponent.java | 36 + .../CompositeScopeInitDestroyComponent.java | 39 + .../component/CompositeScopeInitOnlyComponent.java | 42 + .../component/ConversationalScopeComponent.java | 29 + .../ConversationalScopeComponentImpl.java | 29 + .../ConversationalScopeDestroyOnlyComponent.java | 37 + .../ConversationalScopeInitDestroyComponent.java | 38 + .../ConversationalScopeInitOnlyComponent.java | 38 + .../core/mock/component/OrderException.java | 40 + .../core/mock/component/OrderedDependentPojo.java | 29 + .../mock/component/OrderedDependentPojoImpl.java | 36 + .../core/mock/component/OrderedEagerInitPojo.java | 60 + .../core/mock/component/OrderedInitPojo.java | 28 + .../core/mock/component/OrderedInitPojoImpl.java | 61 + .../tuscany/core/mock/component/OtherTarget.java | 31 + .../core/mock/component/OtherTargetImpl.java | 39 + .../core/mock/component/RequestScopeComponent.java | 30 + .../RequestScopeDestroyOnlyComponent.java | 38 + .../RequestScopeInitDestroyComponent.java | 38 + .../component/RequestScopeInitOnlyComponent.java | 39 + .../core/mock/component/SessionScopeComponent.java | 30 + .../mock/component/SessionScopeComponentImpl.java | 30 + .../SessionScopeInitDestroyComponent.java | 36 + .../component/SessionScopeInitOnlyComponent.java | 37 + .../tuscany/core/mock/component/SimpleTarget.java | 30 + .../core/mock/component/SimpleTargetImpl.java | 41 + .../apache/tuscany/core/mock/component/Source.java | 37 + .../tuscany/core/mock/component/SourceImpl.java | 63 + .../core/mock/component/StatelessComponent.java | 30 + .../mock/component/StatelessComponentImpl.java | 27 + .../apache/tuscany/core/mock/component/Target.java | 32 + .../tuscany/core/mock/component/TargetImpl.java | 38 + .../tuscany/core/mock/wire/MockStaticInvoker.java | 97 ++ .../core/mock/wire/MockSyncInterceptor.java | 55 + .../tuscany/core/mock/wire/MockTargetInvoker.java | 33 + .../monitor/DefaultExceptionFormatterTestCase.java | 63 + .../tuscany/core/monitor/JavaLoggingTestCase.java | 153 +++ .../core/policy/IntentRegistryImplTestCase.java | 152 +++ .../core/policy/PolicyEngineImplTestCase.java | 140 ++ .../core/property/PropertyHelperTestCase.java | 107 ++ .../SimplePropertyObjectFactoryTestCase.java | 113 ++ .../artifact/LocalMavenRepositoryTestCase.java | 82 ++ .../deployment/AssemblyServiceImplTestCase.java | 107 ++ .../ContentTypeDescriberImplTestCase.java | 52 + .../deployment/ContributionLoaderTestCase.java | 82 ++ .../deployment/ContributionRepositoryTestCase.java | 76 ++ .../ContributionServiceImplTestCase.java | 72 + .../CompositeContributionProcessorTestCase.java | 84 ++ .../FolderContributionProcessorTestCase.java | 56 + .../JarContributionProcessorTestCase.java | 53 + .../JavaContributionProcessorTestCase.java | 79 ++ .../DelegatingResourceHostRegistryTestCase.java | 147 ++ .../services/store/memory/MemoryStoreTestCase.java | 164 +++ .../work/jsr237/Jsr237WorkSchedulerTest.java | 81 ++ .../work/jsr237/Jsr237WorkSchedulerTestCase.java | 100 ++ .../workmanager/ThreadPoolWorkManagerTestCase.java | 132 ++ .../java/org/apache/tuscany/core/util/Bean1.java | 45 + .../java/org/apache/tuscany/core/util/Bean2.java | 47 + .../core/util/JavaIntrospectionHelperTestCase.java | 180 +++ .../org/apache/tuscany/core/util/SuperBean.java | 48 + .../BasicReferenceInvocationHandlerTestCase.java | 69 + .../wire/CallbackInterfaceInterceptorTestCase.java | 60 + .../core/wire/ContractCompatibilityTestCase.java | 401 ++++++ .../core/wire/InboundInvocationErrorTestCase.java | 166 +++ ...eServiceContractExceptionFormatterTestCase.java | 82 ++ .../core/wire/InvocationChainImplTestCase.java | 94 ++ .../wire/InvocationConfigurationErrorTestCase.java | 95 ++ .../core/wire/InvocationConfigurationTestCase.java | 95 ++ .../NonBlockingBridgingInterceptorTestCase.java | 75 ++ .../wire/OptimizedWireObjectFactoryTestCase.java | 44 + .../core/wire/OutboundInvocationErrorTestCase.java | 133 ++ .../wire/OutboundInvocationHandlerTestCase.java | 132 ++ .../tuscany/core/wire/OutboundWireTestCase.java | 38 + .../SynchronousBridgingInterceptorTestCase.java | 44 + .../core/wire/WireObjectFactoryTestCase.java | 138 ++ .../core/wire/WireOptimizationTestCase.java | 154 +++ .../core/wire/WireServiceExtensionTestCase.java | 333 +++++ .../tuscany/core/wire/WireUtilsTestCase.java | 94 ++ ...backInvocationHandlerSerializationTestCase.java | 54 + .../jdk/JDKCallbackInvocationHandlerTestCase.java | 54 + ...oundInvocationHandlerSerializationTestCase.java | 110 ++ .../jdk/JDKInboundInvocationHandlerTestCase.java | 162 +++ .../JDKOutboundInvocationHandlerProxyTestCase.java | 80 ++ ...oundInvocationHandlerSerializationTestCase.java | 132 ++ .../jdk/JDKOutboundInvocationHandlerTestCase.java | 176 +++ .../tuscany/core/wire/jdk/JDKProxyTestCase.java | 61 + .../resources/deployables/sample-calculator.jar | Bin 0 -> 26901 bytes .../apache/tuscany/core/databinding/impl/ipo.xsd | 136 ++ .../tuscany/core/databinding/impl/order.wsdl | 76 ++ .../apache/tuscany/core/databinding/xml/foo.xml | 22 + .../tuscany/core/deployer/boot1-include.scdl | 33 + .../org/apache/tuscany/core/deployer/boot1.scdl | 35 + .../org/apache/tuscany/core/deployer/boot2.scdl | 136 ++ .../org/apache/tuscany/core/loader/TestPolicy.scdl | 51 + .../apache/tuscany/core/loader/test-include.scdl | 22 + .../org/apache/tuscany/core/policy/PolicySet.scdl | 66 + .../org/apache/tuscany/core/property/ipo.xml | 33 + .../tuscany/core/services/deployment/test.ext | 0 .../tuscany/core/services/deployment/test.scdl | 22 + .../resources/repository/sample-calculator.jar | Bin 0 -> 26901 bytes .../sca/kernel/host-api/.checkstyle | 24 + .../sca-java-integration/sca/kernel/host-api/.pmd | 20 + .../sca/kernel/host-api/.ruleset | 190 +++ .../sca/kernel/host-api/LICENSE.txt | 202 +++ .../sca/kernel/host-api/NOTICE.txt | 14 + .../sca/kernel/host-api/pom.xml | 50 + .../apache/tuscany/host/AbstractRuntimeInfo.java | 125 ++ .../org/apache/tuscany/host/MonitorFactory.java | 49 + .../java/org/apache/tuscany/host/RuntimeInfo.java | 72 + .../tuscany/host/deployment/AssemblyService.java | 105 ++ .../tuscany/host/deployment/ContentTypes.java | 35 + .../deployment/ContributionProcessorException.java | 76 ++ .../host/deployment/ContributionService.java | 120 ++ .../host/deployment/DeploymentException.java | 51 + .../UnsupportedContentTypeException.java | 48 + .../org/apache/tuscany/host/launcher/Launcher.java | 58 + .../tuscany/host/management/ManagementService.java | 35 + .../tuscany/host/monitor/ExceptionFormatter.java | 34 + .../tuscany/host/monitor/FormatterRegistry.java | 42 + .../java/org/apache/tuscany/host/rmi/RMIHost.java | 49 + .../org/apache/tuscany/host/rmi/RMIHostAdmin.java | 39 + .../apache/tuscany/host/rmi/RMIHostException.java | 45 + .../tuscany/host/rmi/RMIHostRuntimeException.java | 45 + .../host/runtime/InitializationException.java | 37 + .../tuscany/host/runtime/ShutdownException.java | 33 + .../tuscany/host/runtime/TuscanyRuntime.java | 115 ++ .../host/servlet/ServletRequestInjector.java | 41 + .../tuscany/host/rmi/RMIHostExceptionTestCase.java | 54 + .../host/rmi/RMIHostRuntimeExceptionTestCase.java | 54 + .../sca-java-integration/sca/kernel/pom.xml | 181 +++ .../sca/kernel/spi/.checkstyle | 9 + .../sca-java-integration/sca/kernel/spi/.pmd | 2 + .../sca-java-integration/sca/kernel/spi/.ruleset | 190 +++ .../sca/kernel/spi/LICENSE.txt | 202 +++ .../sca-java-integration/sca/kernel/spi/NOTICE.txt | 14 + .../sca-java-integration/sca/kernel/spi/pom.xml | 68 + .../sca/kernel/spi/src/doc/Context Model.emx | 673 ++++++++++ .../org/apache/tuscany/spi/AbstractLifecycle.java | 77 ++ .../apache/tuscany/spi/CoreRuntimeException.java | 55 + .../apache/tuscany/spi/InvalidNameException.java | 45 + .../java/org/apache/tuscany/spi/Lifecycle.java | 69 + .../tuscany/spi/ObjectCreationException.java | 56 + .../java/org/apache/tuscany/spi/ObjectFactory.java | 35 + .../java/org/apache/tuscany/spi/QualifiedName.java | 96 ++ .../apache/tuscany/spi/annotation/Autowire.java | 46 + .../tuscany/spi/bootstrap/ComponentNames.java | 70 + .../tuscany/spi/bootstrap/RuntimeComponent.java | 55 + .../apache/tuscany/spi/builder/BindingBuilder.java | 57 + .../org/apache/tuscany/spi/builder/Builder.java | 86 ++ .../spi/builder/BuilderConfigException.java | 48 + .../tuscany/spi/builder/BuilderException.java | 55 + .../spi/builder/BuilderInstantiationException.java | 39 + .../tuscany/spi/builder/BuilderRegistry.java | 85 ++ .../tuscany/spi/builder/ComponentBuilder.java | 36 + .../org/apache/tuscany/spi/builder/Connector.java | 52 + .../apache/tuscany/spi/builder/GenericBuilder.java | 42 + .../builder/InvalidServiceInterfaceException.java | 35 + .../spi/builder/MissingWireTargetException.java | 36 + .../spi/builder/ScopeNotFoundException.java | 29 + .../tuscany/spi/builder/WiringException.java | 124 ++ .../tuscany/spi/component/AbstractSCAObject.java | 134 ++ .../tuscany/spi/component/AtomicComponent.java | 126 ++ .../apache/tuscany/spi/component/Component.java | 100 ++ .../tuscany/spi/component/ComponentException.java | 52 + .../component/ComponentRegistrationException.java | 45 + .../spi/component/ComponentRuntimeException.java | 54 + .../tuscany/spi/component/CompositeComponent.java | 156 +++ .../spi/component/DuplicateNameException.java | 36 + .../spi/component/IllegalTargetException.java | 33 + .../spi/component/InvalidAutowireInterface.java | 31 + .../InvalidConversationSequenceException.java | 31 + .../spi/component/PersistenceException.java | 41 + .../tuscany/spi/component/PrepareException.java | 35 + .../spi/component/ReactivationException.java | 45 + .../apache/tuscany/spi/component/Reference.java | 34 + .../tuscany/spi/component/ReferenceBinding.java | 88 ++ .../tuscany/spi/component/SCAExternalizable.java | 43 + .../apache/tuscany/spi/component/SCAObject.java | 73 + .../spi/component/SCAObjectStartException.java | 33 + .../spi/component/SCAObjectStopException.java | 33 + .../tuscany/spi/component/ScopeContainer.java | 87 ++ .../spi/component/ScopeContainerMonitor.java | 36 + .../tuscany/spi/component/ScopeRegistry.java | 43 + .../org/apache/tuscany/spi/component/Service.java | 52 + .../tuscany/spi/component/ServiceBinding.java | 95 ++ .../spi/component/TargetDestructionException.java | 40 + .../tuscany/spi/component/TargetException.java | 50 + .../component/TargetInitializationException.java | 39 + .../spi/component/TargetInvocationException.java | 43 + .../component/TargetInvokerCreationException.java | 50 + .../spi/component/TargetNotFoundException.java | 36 + .../spi/component/TargetResolutionException.java | 43 + .../apache/tuscany/spi/component/WorkContext.java | 116 ++ .../tuscany/spi/databinding/DataBinding.java | 99 ++ .../spi/databinding/DataBindingRegistry.java | 70 + .../apache/tuscany/spi/databinding/DataPipe.java | 44 + .../tuscany/spi/databinding/ExceptionHandler.java | 57 + .../apache/tuscany/spi/databinding/Mediator.java | 67 + .../tuscany/spi/databinding/PullTransformer.java | 36 + .../tuscany/spi/databinding/PushTransformer.java | 34 + .../tuscany/spi/databinding/SimpleTypeMapper.java | 44 + .../spi/databinding/TransformationContext.java | 72 + .../spi/databinding/TransformationException.java | 46 + .../tuscany/spi/databinding/Transformer.java | 49 + .../spi/databinding/TransformerRegistry.java | 75 ++ .../tuscany/spi/databinding/WrapperHandler.java | 55 + .../spi/databinding/extension/DOMHelper.java | 69 + .../extension/DataBindingExtension.java | 166 +++ .../extension/Java2SimpleTypeTransformer.java | 60 + .../extension/SimpleType2JavaTransformer.java | 63 + .../extension/SimpleTypeMapperExtension.java | 392 ++++++ .../extension/TransformerExtension.java | 73 + .../extension/XSDDataTypeConverter.java | 940 +++++++++++++ .../tuscany/spi/deployer/ArtifactResolver.java | 84 ++ .../spi/deployer/ArtifactResolverRegistry.java | 45 + .../tuscany/spi/deployer/ChangeSetHandler.java | 48 + .../spi/deployer/ChangeSetHandlerRegistry.java | 28 + .../tuscany/spi/deployer/CompositeClassLoader.java | 52 + .../apache/tuscany/spi/deployer/ContentType.java | 37 + .../tuscany/spi/deployer/ContentTypeDescriber.java | 36 + .../spi/deployer/ContributionProcessor.java | 66 + .../deployer/ContributionProcessorRegistry.java | 36 + .../spi/deployer/ContributionRepository.java | 78 ++ .../org/apache/tuscany/spi/deployer/Deployer.java | 62 + .../tuscany/spi/deployer/DeploymentContext.java | 84 ++ .../tuscany/spi/deployer/DeploymentMonitor.java | 20 + .../tuscany/spi/event/AbstractEventPublisher.java | 83 ++ .../java/org/apache/tuscany/spi/event/Event.java | 33 + .../org/apache/tuscany/spi/event/EventFilter.java | 33 + .../apache/tuscany/spi/event/EventPublisher.java | 50 + .../tuscany/spi/event/RuntimeEventListener.java | 31 + .../org/apache/tuscany/spi/event/TrueFilter.java | 31 + .../spi/extension/AbstractComponentExtension.java | 65 + .../spi/extension/ArtifactResolverExtension.java | 75 ++ .../spi/extension/AtomicComponentExtension.java | 225 ++++ .../spi/extension/BindingBuilderExtension.java | 79 ++ .../spi/extension/ComponentBuilderExtension.java | 100 ++ .../extension/ComponentTypeLoaderExtension.java | 63 + .../spi/extension/CompositeComponentExtension.java | 564 ++++++++ .../extension/ContributionProcessorExtension.java | 75 ++ .../tuscany/spi/extension/ExecutionMonitor.java | 33 + .../spi/extension/GenericBuilderExtension.java | 52 + .../tuscany/spi/extension/LoaderExtension.java | 79 ++ .../spi/extension/ReferenceBindingExtension.java | 78 ++ .../spi/extension/ServiceBindingExtension.java | 90 ++ .../extension/SystemAtomicComponentExtension.java | 45 + .../spi/extension/TargetInvokerExtension.java | 96 ++ .../org/apache/tuscany/spi/host/ResourceHost.java | 46 + .../tuscany/spi/host/ResourceHostRegistry.java | 72 + .../spi/host/ResourceResolutionException.java | 32 + .../org/apache/tuscany/spi/host/ServletHost.java | 58 + .../org/apache/tuscany/spi/idl/ElementInfo.java | 54 + .../InvalidConversationalOperationException.java | 40 + .../spi/idl/InvalidServiceContractException.java | 50 + .../spi/idl/OverloadedOperationException.java | 41 + .../tuscany/spi/idl/ServiceFaultException.java | 82 ++ .../java/org/apache/tuscany/spi/idl/TypeInfo.java | 66 + .../java/org/apache/tuscany/spi/idl/XMLType.java | 124 ++ .../spi/idl/java/InterfaceJavaIntrospector.java | 57 + .../apache/tuscany/spi/idl/java/JavaIDLUtils.java | 104 ++ .../spi/idl/java/JavaInterfaceProcessor.java | 34 + .../idl/java/JavaInterfaceProcessorExtension.java | 47 + .../idl/java/JavaInterfaceProcessorRegistry.java | 39 + .../tuscany/spi/idl/java/JavaServiceContract.java | 39 + .../java/AbstractPropertyProcessor.java | 205 +++ .../implementation/java/ConstructorDefinition.java | 51 + .../java/DuplicatePropertyException.java | 35 + .../java/IllegalPropertyException.java | 36 + .../java/ImplementationProcessor.java | 128 ++ .../java/ImplementationProcessorExtension.java | 118 ++ .../java/ImplementationProcessorService.java | 91 ++ .../implementation/java/IntrospectionRegistry.java | 38 + .../spi/implementation/java/Introspector.java | 47 + .../java/JavaMappedComponentType.java | 61 + .../implementation/java/JavaMappedProperty.java | 64 + .../implementation/java/JavaMappedReference.java | 60 + .../spi/implementation/java/JavaMappedService.java | 91 ++ .../spi/implementation/java/PojoComponentType.java | 121 ++ .../implementation/java/ProcessingException.java | 65 + .../tuscany/spi/implementation/java/Resource.java | 138 ++ .../tuscany/spi/loader/ComponentTypeLoader.java | 45 + .../loader/DuplicateReferenceNameException.java | 81 ++ ...mpatibleOverridingServiceContractException.java | 74 + .../spi/loader/InvalidConfigurationException.java | 36 + .../loader/InvalidPromotedReferenceException.java | 39 + .../spi/loader/InvalidReferenceException.java | 38 + .../spi/loader/InvalidServiceException.java | 30 + .../tuscany/spi/loader/InvalidValueException.java | 40 + .../tuscany/spi/loader/InvalidWireException.java | 45 + .../java/org/apache/tuscany/spi/loader/Loader.java | 92 ++ .../apache/tuscany/spi/loader/LoaderException.java | 92 ++ .../apache/tuscany/spi/loader/LoaderRegistry.java | 69 + .../org/apache/tuscany/spi/loader/LoaderUtil.java | 78 ++ .../spi/loader/MissingImplementationException.java | 35 + .../spi/loader/MissingIncludeException.java | 32 + .../MissingMustOverridePropertyException.java | 30 + .../spi/loader/MissingPropertyValueException.java | 30 + .../spi/loader/MissingReferenceException.java | 32 + .../spi/loader/MissingResourceException.java | 67 + .../spi/loader/MissingSideFileException.java | 31 + .../loader/NotOverridablePropertyException.java | 30 + .../tuscany/spi/loader/PropertyObjectFactory.java | 49 + .../ReferenceMultiplicityOverridingException.java | 78 ++ .../ReferenceMultiplicityViolationException.java | 75 ++ .../tuscany/spi/loader/StAXElementLoader.java | 48 + .../spi/loader/UndefinedPropertyException.java | 28 + .../spi/loader/UndefinedReferenceException.java | 30 + .../loader/UnrecognizedComponentTypeException.java | 42 + .../spi/loader/UnrecognizedElementException.java | 46 + .../tuscany/spi/marshaller/MarshalException.java | 48 + .../tuscany/spi/marshaller/ModelMarshaller.java | 54 + .../spi/model/AbstractReferenceDefinition.java | 137 ++ .../tuscany/spi/model/AtomicImplementation.java | 33 + .../tuscany/spi/model/BindingDefinition.java | 47 + .../tuscany/spi/model/ComponentDefinition.java | 152 +++ .../spi/model/ComponentReferenceDefinition.java | 95 ++ .../apache/tuscany/spi/model/ComponentType.java | 188 +++ .../model/ComponentTypeReferenceDefinition.java | 40 + .../tuscany/spi/model/CompositeComponentType.java | 197 +++ .../tuscany/spi/model/CompositeImplementation.java | 56 + .../spi/model/CompositeReferenceDefinition.java | 55 + .../org/apache/tuscany/spi/model/Contribution.java | 113 ++ .../tuscany/spi/model/ContributionImport.java | 50 + .../org/apache/tuscany/spi/model/DataType.java | 249 ++++ .../apache/tuscany/spi/model/DeployedArtifact.java | 114 ++ .../apache/tuscany/spi/model/Implementation.java | 43 + .../java/org/apache/tuscany/spi/model/Include.java | 80 ++ .../java/org/apache/tuscany/spi/model/Intent.java | 92 ++ .../org/apache/tuscany/spi/model/IntentMap.java | 64 + .../org/apache/tuscany/spi/model/IntentName.java | 140 ++ .../apache/tuscany/spi/model/InteractionScope.java | 29 + .../org/apache/tuscany/spi/model/ModelObject.java | 38 + .../org/apache/tuscany/spi/model/Multiplicity.java | 47 + .../org/apache/tuscany/spi/model/Operation.java | 413 ++++++ .../apache/tuscany/spi/model/OverrideOptions.java | 34 + .../apache/tuscany/spi/model/PolicyAttachable.java | 21 + .../tuscany/spi/model/PolicyAttachableModel.java | 49 + .../tuscany/spi/model/PolicyContentModel.java | 45 + .../org/apache/tuscany/spi/model/PolicyModel.java | 29 + .../org/apache/tuscany/spi/model/PolicySet.java | 99 ++ .../tuscany/spi/model/PolicySetReference.java | 38 + .../org/apache/tuscany/spi/model/Property.java | 132 ++ .../apache/tuscany/spi/model/PropertyValue.java | 134 ++ .../org/apache/tuscany/spi/model/Qualifier.java | 51 + .../apache/tuscany/spi/model/ReferenceTarget.java | 50 + .../java/org/apache/tuscany/spi/model/Scope.java | 61 + .../apache/tuscany/spi/model/ServiceContract.java | 279 ++++ .../tuscany/spi/model/ServiceDefinition.java | 163 +++ .../tuscany/spi/model/WSPolicyAttachment.java | 35 + .../apache/tuscany/spi/model/WireDefinition.java | 47 + .../org/apache/tuscany/spi/model/WrapperInfo.java | 141 ++ .../apache/tuscany/spi/policy/IntentRegistry.java | 83 ++ .../tuscany/spi/policy/PolicyBuilderRegistry.java | 70 + .../apache/tuscany/spi/policy/PolicyEngine.java | 42 + .../tuscany/spi/policy/PolicySetContainer.java | 46 + .../apache/tuscany/spi/policy/SCATypeManager.java | 29 + .../tuscany/spi/policy/SourcePolicyBuilder.java | 41 + .../spi/policy/SourcePolicyBuilderExtension.java | 53 + .../tuscany/spi/policy/TargetPolicyBuilder.java | 41 + .../spi/policy/TargetPolicyBuilderExtension.java | 53 + .../tuscany/spi/resolver/ResolutionException.java | 52 + .../org/apache/tuscany/spi/resolver/Resolver.java | 37 + .../tuscany/spi/resolver/ResolverRegistry.java | 46 + .../apache/tuscany/spi/services/VoidService.java | 33 + .../tuscany/spi/services/artifact/Artifact.java | 197 +++ .../spi/services/artifact/ArtifactRepository.java | 45 + .../discovery/AbstractDiscoveryService.java | 149 +++ .../spi/services/discovery/DiscoveryException.java | 48 + .../spi/services/discovery/DiscoveryService.java | 75 ++ .../spi/services/discovery/RequestListener.java | 39 + .../spi/services/discovery/ResponseListener.java | 40 + .../management/TuscanyManagementService.java | 40 + .../services/store/DuplicateRecordException.java | 31 + .../spi/services/store/RecoveryListener.java | 46 + .../apache/tuscany/spi/services/store/Store.java | 96 ++ .../tuscany/spi/services/store/StoreException.java | 54 + .../spi/services/store/StoreExpirationEvent.java | 71 + .../tuscany/spi/services/store/StoreMonitor.java | 74 + .../spi/services/store/StoreReadException.java | 41 + .../spi/services/store/StoreWriteException.java | 43 + .../spi/services/work/NotificationListener.java | 66 + .../tuscany/spi/services/work/WorkScheduler.java | 52 + .../spi/services/work/WorkSchedulerException.java | 41 + .../tuscany/spi/util/SCAObjectInputStream.java | 60 + .../org/apache/tuscany/spi/util/stax/StaxUtil.java | 401 ++++++ .../spi/wire/AbstractInboundInvocationHandler.java | 54 + .../wire/AbstractOutboundInvocationHandler.java | 104 ++ .../tuscany/spi/wire/InboundInvocationChain.java | 29 + .../org/apache/tuscany/spi/wire/InboundWire.java | 89 ++ .../wire/IncompatibleServiceContractException.java | 74 + .../org/apache/tuscany/spi/wire/Interceptor.java | 50 + .../apache/tuscany/spi/wire/InvocationChain.java | 95 ++ .../spi/wire/InvocationRuntimeException.java | 46 + .../java/org/apache/tuscany/spi/wire/Message.java | 120 ++ .../org/apache/tuscany/spi/wire/MessageId.java | 56 + .../org/apache/tuscany/spi/wire/MessageImpl.java | 116 ++ .../tuscany/spi/wire/OutboundChainHolder.java | 38 + .../tuscany/spi/wire/OutboundInvocationChain.java | 28 + .../org/apache/tuscany/spi/wire/OutboundWire.java | 106 ++ .../tuscany/spi/wire/ProxyCreationException.java | 51 + .../org/apache/tuscany/spi/wire/TargetInvoker.java | 79 ++ .../java/org/apache/tuscany/spi/wire/Wire.java | 82 ++ .../tuscany/spi/wire/WireInvocationHandler.java | 32 + .../apache/tuscany/spi/wire/WireObjectFactory.java | 48 + .../apache/tuscany/spi/wire/WirePostProcessor.java | 40 + .../spi/wire/WirePostProcessorExtension.java | 44 + .../spi/wire/WirePostProcessorRegistry.java | 44 + .../org/apache/tuscany/spi/wire/WireService.java | 157 +++ .../org/apache/tuscany/spi/AssertionTestCase.java | 38 + .../apache/tuscany/spi/QualifiedNameTestCase.java | 67 + .../spi/TuscanyRuntimeExceptionTestCase.java | 69 + .../spi/annotation/ConstructorAnnotationTest.java | 60 + .../spi/component/AbstractSCAObjectTestCase.java | 128 ++ .../databinding/extension/DOMHelperTestCase.java | 55 + .../extension/DataBindingExtensionTestCase.java | 83 ++ .../SimpleTypeMapperExtensionTestCase.java | 114 ++ .../extension/TransformerExtensionTestCase.java | 74 + .../extension/XSDDataTypeConverterTestCase.java | 60 + .../spi/event/AbstractEventPublisherTestCase.java | 92 ++ .../AtomicComponentExtensionTestCase.java | 148 ++ .../ComponentTypeLoaderExtensionTestCase.java | 60 + ...ompositeComponentExtensionAutowireTestCase.java | 302 +++++ .../CompositeComponentExtensionTestCase.java | 332 +++++ .../spi/extension/LoaderExtensionTestCase.java | 71 + .../ReferenceBindingExtensionTestCase.java | 67 + .../tuscany/spi/extension/ReferenceTestCase.java | 94 ++ .../extension/ServiceBindingExtensionTestCase.java | 87 ++ .../TargetInvokerExtensionSequenceTestCase.java | 169 +++ .../extension/TargetInvokerExtensionTestCase.java | 82 ++ .../tuscany/spi/idl/java/JavaIDLUtilsTestCase.java | 178 +++ .../java/AbstractPropertyProcessorTestCase.java | 176 +++ .../spi/loader/LoaderExceptionTestCase.java | 33 + .../spi/model/CompositeComponentTypeTestCase.java | 43 + .../tuscany/spi/model/IntentNameTestCase.java | 16 + .../tuscany/spi/model/OperationTestCase.java | 52 + .../apache/tuscany/spi/model/ScopeTestCase.java | 59 + .../tuscany/spi/model/ServiceContractTestCase.java | 85 ++ .../SourcePolicyBuilderExtensionTestCase.java | 50 + .../TargetPolicyBuilderExtensionTestCase.java | 50 + .../tuscany/spi/util/MockSCAExternalizable.java | 52 + .../apache/tuscany/spi/util/MockSerializable.java | 42 + .../spi/util/SCAObjectInputStreamTestCase.java | 51 + .../tuscany/spi/util/stax/StaxUtilTestCase.java | 58 + .../AbstractInboundInvocationHandlerTestCase.java | 55 + .../AbstractOutboundInvocationHandlerTestCase.java | 102 ++ .../spi/wire/OutboundChainHolderTestCase.java | 35 + .../sca/kernel/spi/src/test/resources/test.scdl | 34 + .../branches/sca-java-integration/sca/pom.xml | 335 +++++ .../services/databinding/databinding-jaxb/.ruleset | 172 +++ .../databinding/databinding-jaxb/LICENSE.txt | 202 +++ .../databinding/databinding-jaxb/NOTICE.txt | 14 + .../services/databinding/databinding-jaxb/pom.xml | 148 ++ .../apache/tuscany/databinding/jaxb/JAXB2Node.java | 72 + .../databinding/jaxb/JAXBContextHelper.java | 192 +++ .../tuscany/databinding/jaxb/JAXBDataBinding.java | 114 ++ .../databinding/jaxb/JAXBExceptionHandler.java | 106 ++ .../databinding/jaxb/JAXBWrapperHandler.java | 123 ++ .../jaxb/JAXWSJavaInterfaceProcessor.java | 107 ++ .../apache/tuscany/databinding/jaxb/Node2JAXB.java | 69 + .../tuscany/databinding/jaxb/Reader2JAXB.java | 70 + .../databinding/jaxb/XMLStreamReader2JAXB.java | 70 + .../resources/META-INF/sca/databinding.jaxb.scdl | 49 + .../src/main/resources/META-INF/sca/default.scdl | 49 + .../resources/META-INF/sca/extension.composite | 22 + .../databinding/jaxb/JAXBDataBindingTestCase.java | 127 ++ .../jaxb/JAXBExceptionHandlerTestCase.java | 77 ++ .../tuscany/databinding/jaxb/JAXBTestCase.java | 158 +++ .../jaxb/JAXBWrapperHandlerTestCase.java | 72 + .../databinding/jaxb/fault/InvalidSymbolFault.java | 59 + .../jaxb/fault/InvalidSymbolFault_Exception.java | 44 + .../databinding-jaxb/src/test/resources/ipo.xsd | 118 ++ .../services/databinding/databinding-json/.ruleset | 172 +++ .../databinding/databinding-json/LICENSE.txt | 202 +++ .../databinding/databinding-json/NOTICE.txt | 14 + .../services/databinding/databinding-json/pom.xml | 70 + .../databinding/json/JSON2XMLStreamReader.java | 62 + .../tuscany/databinding/json/JSONDataBinding.java | 52 + .../databinding/json/XMLStreamReader2JSON.java | 69 + .../databinding/json/XMLStreamSerializer.java | 272 ++++ .../databinding/json/axiom/JSON2OMElement.java | 83 ++ .../json/axiom/JSONBadgerfishDataSource.java | 56 + .../databinding/json/axiom/JSONDataSource.java | 174 +++ .../resources/META-INF/sca/databinding.json.scdl | 43 + .../resources/META-INF/sca/extension.composite | 22 + .../databinding/json/JSONTransformerTestCase.java | 91 ++ .../databinding-json/src/test/resources/ipo.xsd | 118 ++ .../databinding/databinding-sdo-axiom/.checkstyle | 6 + .../databinding/databinding-sdo-axiom/.ruleset | 172 +++ .../databinding/databinding-sdo-axiom/LICENSE.txt | 202 +++ .../databinding/databinding-sdo-axiom/NOTICE.txt | 14 + .../databinding/databinding-sdo-axiom/pom.xml | 138 ++ .../databinding/sdo2om/DataObject2OMElement.java | 89 ++ .../databinding/sdo2om/DataObjectSerializer.java | 408 ++++++ .../tuscany/databinding/sdo2om/SDODataSource.java | 66 + .../databinding/sdo2om/XMLDocument2OMElement.java | 64 + .../META-INF/sca/databinding.sdo-axiom.scdl | 39 + .../resources/META-INF/sca/extension.composite | 22 + .../sdo2om/DataObject2OMElementTestCase.java | 38 + .../sdo2om/MockTransformationContext.java | 83 ++ .../sdo2om/SDOTransformerTestCaseBase.java | 78 ++ .../sdo2om/XMLDocument2OMElementTestCase.java | 45 + .../src/test/resources/ipo.xsd | 118 ++ .../src/test/resources/stock.xsd | 33 + .../databinding/databinding-sdo/.checkstyle | 6 + .../services/databinding/databinding-sdo/.ruleset | 172 +++ .../databinding/databinding-sdo/LICENSE.txt | 202 +++ .../databinding/databinding-sdo/NOTICE.txt | 14 + .../services/databinding/databinding-sdo/pom.xml | 119 ++ .../tuscany/databinding/sdo/DataObject2String.java | 61 + .../sdo/DataObject2XMLStreamReader.java | 70 + .../tuscany/databinding/sdo/DataObjectLoader.java | 73 + .../apache/tuscany/databinding/sdo/ImportSDO.java | 47 + .../tuscany/databinding/sdo/ImportSDOBuilder.java | 57 + .../tuscany/databinding/sdo/ImportSDOLoader.java | 163 +++ .../tuscany/databinding/sdo/ModelDataObject.java | 43 + .../tuscany/databinding/sdo/SDOContextHelper.java | 111 ++ .../tuscany/databinding/sdo/SDODataBinding.java | 122 ++ .../databinding/sdo/SDOExceptionHandler.java | 123 ++ .../tuscany/databinding/sdo/SDOHelperContext.java | 48 + .../databinding/sdo/SDOSimpleTypeMapper.java | 66 + .../tuscany/databinding/sdo/SDOWrapperHandler.java | 99 ++ .../tuscany/databinding/sdo/String2DataObject.java | 58 + .../databinding/sdo/XMLDocument2String.java | 62 + .../sdo/XMLDocument2XMLStreamReader.java | 66 + .../sdo/XMLStreamReader2DataObject.java | 67 + .../sdo/XMLStreamReader2XMLDocument.java | 61 + .../resources/META-INF/sca/databinding.sdo.scdl | 72 + .../src/main/resources/META-INF/sca/default.scdl | 66 + .../resources/META-INF/sca/extension.composite | 22 + .../sdo/fault/InvalidSymbolFault_Exception.java | 67 + .../databinding/sdo/DataObject2StringTestCase.java | 64 + .../sdo/DataObject2XMLStreamReaderTestCase.java | 57 + .../databinding/sdo/DataObjectLoaderTestCase.java | 82 ++ .../databinding/sdo/ImportSDOLoaderTestCase.java | 87 ++ .../databinding/sdo/SDODataBindingTestCase.java | 110 ++ .../sdo/SDOExceptionHandlerTestCase.java | 81 ++ .../sdo/SDOTransformerTestCaseBase.java | 79 ++ .../databinding/sdo/SDOWrapperHandlerTestCase.java | 65 + .../sdo/XMLDocument2XMLStreamReaderTestCase.java | 60 + .../META-INF/tuscany/databinding.sdo.scdl | 34 + .../databinding-sdo/src/test/resources/ipo.xsd | 118 ++ .../src/test/resources/model/sca-core.xsd | 233 ++++ .../resources/model/sca-implementation-mock.xsd | 43 + .../databinding-sdo/src/test/resources/stock.xsd | 33 + .../databinding-sdo/src/test/resources/wrapper.xml | 9 + .../databinding-sdo/src/test/resources/wrapper.xsd | 38 + .../databinding/databinding-xmlbeans/.ruleset | 172 +++ .../databinding/databinding-xmlbeans/LICENSE.txt | 202 +++ .../databinding/databinding-xmlbeans/NOTICE.txt | 14 + .../databinding/databinding-xmlbeans/pom.xml | 97 ++ .../databinding/xmlbeans/Node2XmlObject.java | 56 + .../databinding/xmlbeans/XMLBeansDataBinding.java | 35 + .../xmlbeans/XMLStreamReader2XmlObject.java | 56 + .../databinding/xmlbeans/XmlObject2Node.java | 52 + .../xmlbeans/XmlObject2XMLStreamReader.java | 47 + .../META-INF/sca/databinding.xmlbeans.scdl | 43 + .../src/main/resources/META-INF/sca/default.scdl | 43 + .../resources/META-INF/sca/extension.composite | 22 + .../databinding/xmlbeans/XmlObjectTestCase.java | 99 ++ .../src/test/resources/ipo.xsd | 118 ++ .../src/test/resources/ipo.xsdconfig | 21 + .../sca/services/databinding/pom.xml | 70 + .../sca-java-integration/sca/services/idl/pom.xml | 61 + .../sca/services/idl/wsdl/.ruleset | 190 +++ .../sca/services/idl/wsdl/LICENSE.txt | 202 +++ .../sca/services/idl/wsdl/NOTICE.txt | 14 + .../sca/services/idl/wsdl/pom.xml | 57 + .../idl/wsdl/InterfaceWSDLIntrospector.java | 48 + .../idl/wsdl/InterfaceWSDLIntrospectorImpl.java | 102 ++ .../tuscany/idl/wsdl/InterfaceWSDLLoader.java | 146 ++ .../tuscany/idl/wsdl/InvalidFragmentException.java | 30 + .../idl/wsdl/InvalidWSDLContributionException.java | 36 + .../tuscany/idl/wsdl/InvalidWSDLException.java | 34 + .../idl/wsdl/InvalidWSDLLocationException.java | 33 + .../idl/wsdl/NotSupportedWSDLException.java | 37 + .../idl/wsdl/UnresolveableResourceException.java | 34 + .../idl/wsdl/WSDLContributionProcessor.java | 263 ++++ .../tuscany/idl/wsdl/WSDLDefinitionRegistry.java | 91 ++ .../idl/wsdl/WSDLDefinitionRegistryImpl.java | 214 +++ .../org/apache/tuscany/idl/wsdl/WSDLLoader.java | 110 ++ .../tuscany/idl/wsdl/WSDLLoaderException.java | 45 + .../apache/tuscany/idl/wsdl/WSDLLoaderImpl.java | 141 ++ .../org/apache/tuscany/idl/wsdl/WSDLLocation.java | 60 + .../org/apache/tuscany/idl/wsdl/WSDLOperation.java | 525 ++++++++ .../tuscany/idl/wsdl/WSDLServiceContract.java | 60 + .../apache/tuscany/idl/wsdl/XMLSchemaRegistry.java | 87 ++ .../tuscany/idl/wsdl/XMLSchemaRegistryImpl.java | 129 ++ .../tuscany/idl/wsdl/XSDContributionProcessor.java | 136 ++ .../src/main/resources/META-INF/sca/default.scdl | 50 + .../resources/META-INF/sca/extension.composite | 22 + .../src/main/resources/META-INF/sca/idl.wsdl.scdl | 52 + .../InterfaceWSDLIntrospectorImplTestCase.java | 83 ++ .../wsdl/WSDLContributionProcessorTestCase.java | 86 ++ .../idl/wsdl/WSDLDefinitionRegistryTestCase.java | 91 ++ .../tuscany/idl/wsdl/WSDLLoaderImplTestCase.java | 53 + .../tuscany/idl/wsdl/WSDLOperationTestCase.java | 115 ++ .../idl/wsdl/WrapperStyleOperationTestCase.java | 72 + .../idl/wsdl/XMLSchemaRegistryImplTestCase.java | 105 ++ .../idl/wsdl/XSDContributionProcessorTestCase.java | 92 ++ .../org/apache/tuscany/idl/wsdl/example.wsdl | 26 + .../tuscany/idl/wsdl/invalid-stockquote.wsdl | 40 + .../resources/org/apache/tuscany/idl/wsdl/ipo.xsd | 118 ++ .../org/apache/tuscany/idl/wsdl/stockquote.wsdl | 40 + .../org/apache/tuscany/idl/wsdl/test1.wsdl | 45 + .../org/apache/tuscany/idl/wsdl/test1.xsd | 15 + .../org/apache/tuscany/idl/wsdl/test2.wsdl | 63 + .../tuscany/idl/wsdl/unwrapped-stockquote.wsdl | 58 + .../sca-java-integration/sca/services/pom.xml | 63 + .../sca/services/transports/http.jetty/.ruleset | 190 +++ .../sca/services/transports/http.jetty/LICENSE.txt | 202 +++ .../sca/services/transports/http.jetty/NOTICE.txt | 14 + .../sca/services/transports/http.jetty/pom.xml | 71 + .../apache/tuscany/service/jetty/JettyLogger.java | 106 ++ .../apache/tuscany/service/jetty/JettyService.java | 38 + .../tuscany/service/jetty/JettyServiceImpl.java | 356 +++++ .../tuscany/service/jetty/TransportMonitor.java | 42 + .../main/resources/META-INF/sca/http.jetty.scdl | 35 + .../main/resources/META-INF/sca/service.composite | 22 + .../service/jetty/JettyServiceImplTestCase.java | 220 +++ .../sca-java-integration/spec/commonj/LICENSE.txt | 203 +++ .../sca-java-integration/spec/commonj/NOTICE.txt | 14 + .../sca-java-integration/spec/commonj/pom.xml | 102 ++ .../java/commonj/timers/CancelTimerListener.java | 38 + .../java/commonj/timers/StopTimerListener.java | 38 + .../src/main/java/commonj/timers/Timer.java | 41 + .../main/java/commonj/timers/TimerListener.java | 38 + .../src/main/java/commonj/timers/TimerManager.java | 79 ++ .../src/main/java/commonj/work/RemoteWorkItem.java | 41 + .../commonj/src/main/java/commonj/work/Work.java | 39 + .../java/commonj/work/WorkCompletedException.java | 72 + .../src/main/java/commonj/work/WorkEvent.java | 45 + .../src/main/java/commonj/work/WorkException.java | 49 + .../src/main/java/commonj/work/WorkItem.java | 39 + .../src/main/java/commonj/work/WorkListener.java | 44 + .../src/main/java/commonj/work/WorkManager.java | 51 + .../java/commonj/work/WorkRejectedException.java | 50 + .../branches/sca-java-integration/spec/pom.xml | 49 + .../spec/sca-api-r0.95/LICENSE.txt | 202 +++ .../spec/sca-api-r0.95/NOTICE.txt | 14 + .../spec/sca-api-r0.95/README.txt | 35 + .../spec/sca-api-r0.95/pom.xml | 102 ++ .../main/java/org/osoa/sca/CompositeContext.java | 93 ++ .../org/osoa/sca/ConversationEndedException.java | 67 + .../java/org/osoa/sca/CurrentCompositeContext.java | 50 + .../osoa/sca/NoRegisteredCallbackException.java | 68 + .../src/main/java/org/osoa/sca/RequestContext.java | 49 + .../main/java/org/osoa/sca/ServiceReference.java | 69 + .../java/org/osoa/sca/ServiceRuntimeException.java | 69 + .../org/osoa/sca/ServiceUnavailableException.java | 66 + .../src/main/java/org/osoa/sca/Version.java | 45 + .../sca/annotations/AllowsPassByReference.java | 38 + .../java/org/osoa/sca/annotations/Callback.java | 44 + .../org/osoa/sca/annotations/ComponentName.java | 35 + .../java/org/osoa/sca/annotations/Constructor.java | 35 + .../java/org/osoa/sca/annotations/Context.java | 36 + .../org/osoa/sca/annotations/Conversation.java | 51 + .../org/osoa/sca/annotations/ConversationID.java | 35 + .../java/org/osoa/sca/annotations/Destroy.java | 35 + .../java/org/osoa/sca/annotations/EagerInit.java | 43 + .../org/osoa/sca/annotations/EndConversation.java | 34 + .../main/java/org/osoa/sca/annotations/Init.java | 36 + .../main/java/org/osoa/sca/annotations/OneWay.java | 36 + .../java/org/osoa/sca/annotations/Property.java | 54 + .../java/org/osoa/sca/annotations/Reference.java | 46 + .../java/org/osoa/sca/annotations/Remotable.java | 36 + .../java/org/osoa/sca/annotations/Resource.java | 49 + .../main/java/org/osoa/sca/annotations/Scope.java | 45 + .../java/org/osoa/sca/annotations/Service.java | 43 + .../src/main/resources/schemas/sca-binding-sca.xsd | 38 + .../resources/schemas/sca-binding-webservice.xsd | 39 + .../src/main/resources/schemas/sca-core.xsd | 233 ++++ .../resources/schemas/sca-implementation-java.xsd | 39 + .../main/resources/schemas/sca-interface-java.xsd | 40 + .../main/resources/schemas/sca-interface-wsdl.xsd | 40 + .../src/main/resources/schemas/sca.xsd | 34 + .../org/osoa/sca/annotations/CallbackTestCase.java | 70 + .../osoa/sca/annotations/usage/CallbackType.java | 49 + .../spec/sca-api-r1.0/LICENSE.txt | 202 +++ .../spec/sca-api-r1.0/NOTICE.txt | 14 + .../sca-java-integration/spec/sca-api-r1.0/pom.xml | 87 ++ .../main/java/org/osoa/sca/CallableReference.java | 65 + .../main/java/org/osoa/sca/ComponentContext.java | 109 ++ .../main/java/org/osoa/sca/CompositeContext.java | 95 ++ .../src/main/java/org/osoa/sca/Constants.java | 34 + .../src/main/java/org/osoa/sca/Conversation.java | 41 + .../org/osoa/sca/ConversationEndedException.java | 67 + .../java/org/osoa/sca/CurrentCompositeContext.java | 52 + .../osoa/sca/NoRegisteredCallbackException.java | 68 + .../src/main/java/org/osoa/sca/RequestContext.java | 66 + .../main/java/org/osoa/sca/ServiceReference.java | 65 + .../java/org/osoa/sca/ServiceRuntimeException.java | 69 + .../org/osoa/sca/ServiceUnavailableException.java | 65 + .../sca/annotations/AllowsPassByReference.java | 38 + .../org/osoa/sca/annotations/Authentication.java | 69 + .../java/org/osoa/sca/annotations/Callback.java | 49 + .../org/osoa/sca/annotations/ComponentName.java | 35 + .../org/osoa/sca/annotations/Confidentiality.java | 69 + .../java/org/osoa/sca/annotations/Constructor.java | 35 + .../java/org/osoa/sca/annotations/Context.java | 38 + .../sca/annotations/ConversationAttributes.java | 56 + .../org/osoa/sca/annotations/ConversationID.java | 35 + .../org/osoa/sca/annotations/Conversational.java | 37 + .../java/org/osoa/sca/annotations/Destroy.java | 35 + .../java/org/osoa/sca/annotations/EagerInit.java | 35 + .../org/osoa/sca/annotations/EndsConversation.java | 34 + .../main/java/org/osoa/sca/annotations/Init.java | 36 + .../java/org/osoa/sca/annotations/Integrity.java | 69 + .../main/java/org/osoa/sca/annotations/Intent.java | 58 + .../main/java/org/osoa/sca/annotations/OneWay.java | 35 + .../java/org/osoa/sca/annotations/PolicySets.java | 45 + .../java/org/osoa/sca/annotations/Property.java | 56 + .../java/org/osoa/sca/annotations/Qualifier.java | 35 + .../java/org/osoa/sca/annotations/Reference.java | 50 + .../java/org/osoa/sca/annotations/Remotable.java | 36 + .../java/org/osoa/sca/annotations/Requires.java | 56 + .../main/java/org/osoa/sca/annotations/Scope.java | 48 + .../java/org/osoa/sca/annotations/Service.java | 47 + .../testing/sca/interop/clients/pom.xml | 52 + .../clients/webserviceInteropDoc/LICENSE.txt | 202 +++ .../clients/webserviceInteropDoc/NOTICE.txt | 14 + .../interop/clients/webserviceInteropDoc/pom.xml | 77 ++ .../LoopbackInteropDocServiceComponentImpl.java | 49 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/META-INF/sca/default.scdl | 50 + .../tuscany/extensions/includes/binding.axis2.scdl | 39 + .../extensions/includes/databinding.axiom.scdl | 50 + .../extensions/includes/databinding.sdo.scdl | 60 + .../extensions/includes/interface.wsdl.scdl | 55 + .../tuscany/extensions/test-extensions.scdl | 25 + .../src/main/resources/wsdl/interopdoc.wsdl | 185 +++ .../interop/client/InteropDocClientTestCase.java | 155 +++ .../clients/webserviceSOAPRound2/LICENSE.txt | 202 +++ .../clients/webserviceSOAPRound2/NOTICE.txt | 14 + .../interop/clients/webserviceSOAPRound2/pom.xml | 77 ++ .../test/interop/client/InteropTestDocLit.java | 44 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/META-INF/sca/default.scdl | 38 + .../tuscany/extensions/includes/binding.axis2.scdl | 39 + .../extensions/includes/databinding.axiom.scdl | 50 + .../extensions/includes/databinding.sdo.scdl | 60 + .../extensions/includes/interface.wsdl.scdl | 55 + .../tuscany/extensions/test-extensions.scdl | 25 + .../src/main/resources/wsdl/interoptestdoclit.wsdl | 155 +++ .../interop/client/InteropTestDocLitTestCase.java | 133 ++ .../sca/interop/clients/webserviceXSQ/LICENSE.txt | 202 +++ .../sca/interop/clients/webserviceXSQ/NOTICE.txt | 14 + .../sca/interop/clients/webserviceXSQ/pom.xml | 60 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/test/java/interop/ClientTestCase.java | 77 ++ .../src/test/resources/META-INF/sca/test.scdl | 31 + .../resources/META-INF/tuscany/binding.axis2.scdl | 39 + .../META-INF/tuscany/databinding.axiom.scdl | 52 + .../META-INF/tuscany/databinding.sdo.scdl | 60 + .../resources/META-INF/tuscany/interface.wsdl.scdl | 55 + .../META-INF/tuscany/test-extensions.scdl | 29 + .../webserviceXSQ/src/test/resources/wsdl/sq.wsdl | 142 ++ .../testing/sca/interop/pom.xml | 41 + .../testing/sca/interop/services/pom.xml | 33 + .../services/webserviceInteropDoc/LICENSE.txt | 202 +++ .../services/webserviceInteropDoc/NOTICE.txt | 14 + .../interop/services/webserviceInteropDoc/pom.xml | 109 ++ .../server/InteropDocServiceComponentImpl.java | 47 + .../src/main/resources/wsdl/interopdoc.wsdl | 180 +++ .../src/main/webapp/META-INF/sca/default.scdl | 42 + .../src/main/webapp/WEB-INF/web.xml | 51 + .../interop/services/webserviceInteropDoc/t.bat | 16 + .../testing/sca/itest/IntegrationTestHelp.html | 1293 ++++++++++++++++++ .../sca/itest/bindings/bindingsclient/pom.xml | 64 + .../tuscany/sca/itest/SCATestToolService.java | 40 + .../src/main/resources/bindingsclient.composite | 47 + .../src/main/resources/wsdl/testtool.wsdl | 272 ++++ .../bindingsclient/src/main/webapp/SCATestTool.jsp | 110 ++ .../bindingsclient/src/main/webapp/WEB-INF/web.xml | 10 + .../tuscany/sca/itest/SCATestToolServerTest.java | 27 + .../sca/itest/WSBindingsClientTestCase.java | 80 ++ .../tuscany/sca/util/SCATestUtilityServerTest.java | 28 + .../sca/itest/bindings/bindingscomposite/pom.xml | 58 + .../tuscany/sca/itest/SCADataTypeHelper.java | 341 +++++ .../sca/itest/SCADataTypeHelperException.java | 29 + .../sca/itest/SCATestToolCallbackService.java | 27 + .../tuscany/sca/itest/SCATestToolServer.java | 28 + .../tuscany/sca/itest/SCATestToolService.java | 39 + .../tuscany/sca/itest/SCATestToolServiceImpl.java | 76 ++ .../tuscany/sca/util/SCATestUtilityService.java | 64 + .../resources/bindingscomposite-system.composite | 36 + .../src/main/resources/bindingscomposite.composite | 49 + .../src/main/resources/wsdl/testtool.wsdl | 272 ++++ .../src/main/resources/wsdl/testutility.wsdl | 704 ++++++++++ .../sca/itest/SCATestToolServerTestCase.java | 27 + .../sca/itest/bindings/bindingsutility/pom.xml | 59 + .../sca/itest/SCATestToolCallbackService.java | 28 + .../tuscany/sca/util/SCATestUtilityServer.java | 28 + .../tuscany/sca/util/SCATestUtilityService.java | 64 + .../sca/util/SCATestUtilityServiceImpl.java | 157 +++ .../resources/bindingsutility-system.composite | 36 + .../src/main/resources/bindingsutility.composite | 39 + .../src/main/resources/wsdl/testutility.wsdl | 704 ++++++++++ .../sca/util/SCATestUtilityServerTestCase.java | 27 + .../testing/sca/itest/bindings/pom.xml | 42 + .../testing/sca/itest/callback-api/pom.xml | 35 + .../tuscany/sca/test/CallBackApiCallBack.java | 33 + .../apache/tuscany/sca/test/CallBackApiClient.java | 28 + .../tuscany/sca/test/CallBackApiClientImpl.java | 133 ++ .../tuscany/sca/test/CallBackApiService.java | 37 + .../tuscany/sca/test/CallBackApiServiceImpl.java | 77 ++ .../src/main/resources/CallBackApiTest.composite | 34 + .../apache/tuscany/sca/test/CallBackApiTest.java | 45 + .../testing/sca/itest/callback-basic/pom.xml | 35 + .../tuscany/sca/test/CallBackBasicCallBack.java | 33 + .../tuscany/sca/test/CallBackBasicClient.java | 28 + .../tuscany/sca/test/CallBackBasicClientImpl.java | 134 ++ .../tuscany/sca/test/CallBackBasicService.java | 37 + .../tuscany/sca/test/CallBackBasicServiceImpl.java | 59 + .../src/main/resources/CallBackBasicTest.composite | 34 + .../tuscany/sca/test/CallBackBasicTestCase.java | 28 + .../testing/sca/itest/callback-complexType/pom.xml | 35 + .../tuscany/sca/test/CallBackCTypeCallBack.java | 33 + .../tuscany/sca/test/CallBackCTypeClient.java | 28 + .../tuscany/sca/test/CallBackCTypeClientImpl.java | 142 ++ .../tuscany/sca/test/CallBackCTypeService.java | 36 + .../tuscany/sca/test/CallBackCTypeServiceImpl.java | 63 + .../main/resources/CallBackCTypeClient.composite | 34 + .../test/CallBackCTypeServiceImpl.componentType | 8 + .../apache/tuscany/sca/test/CallBackCTypeTest.java | 45 + .../testing/sca/itest/callback-id/pom.xml | 35 + .../tuscany/sca/test/CallBackIdCallBack.java | 31 + .../apache/tuscany/sca/test/CallBackIdClient.java | 28 + .../tuscany/sca/test/CallBackIdClientImpl.java | 145 ++ .../apache/tuscany/sca/test/CallBackIdService.java | 33 + .../tuscany/sca/test/CallBackIdServiceImpl.java | 48 + .../src/main/resources/CallBackIdClient.composite | 34 + .../apache/tuscany/sca/test/CallBackIdTest.java | 25 + .../testing/sca/itest/callback-setCallback/pom.xml | 35 + .../sca/test/CallBackSetCalbackService.java | 34 + .../sca/test/CallBackSetCallbackBadCallback.java | 41 + .../sca/test/CallBackSetCallbackCallback.java | 31 + .../sca/test/CallBackSetCallbackCallbackImpl.java | 66 + .../sca/test/CallBackSetCallbackClient.java | 28 + .../sca/test/CallBackSetCallbackClientImpl.java | 193 +++ .../test/CallBackSetCallbackObjectCallback.java | 44 + .../sca/test/CallBackSetCallbackServiceImpl.java | 103 ++ .../resources/CallBackSetCallbackTest.composite | 40 + .../tuscany/sca/test/CallBackSetCallbackTest.java | 46 + .../itest/callback-setCallbackConversation/pom.xml | 35 + .../test/CallBackSetCallbackConvBadCallback.java | 40 + .../sca/test/CallBackSetCallbackConvCallback.java | 31 + .../sca/test/CallBackSetCallbackConvClient.java | 28 + .../test/CallBackSetCallbackConvClientImpl.java | 175 +++ .../CallBackSetCallbackConvNonSerCallback.java | 58 + .../CallBackSetCallbackConvObjectCallback.java | 60 + .../sca/test/CallBackSetCallbackConvService.java | 36 + .../test/CallBackSetCallbackConvServiceImpl.java | 102 ++ .../CallBackSetCallbackConvTest.composite | 34 + .../sca/test/CallBackSetCallbackConvTest.java | 46 + .../testing/sca/itest/contribution/pom.xml | 33 + .../resources/META-INF/sca/application.composite | 24 + .../ContributionDirectoryWatcherTestCase.java | 41 + .../contribution/ContributionServiceTestCase.java | 83 ++ .../resources/deployables/sample-calculator.jar | Bin 0 -> 26901 bytes .../resources/repository/sample-calculator.jar | Bin 0 -> 26901 bytes .../testing/sca/itest/conversations/pom.xml | 35 + .../apache/tuscany/sca/test/AnotherService.java | 18 + .../tuscany/sca/test/AnotherServiceImpl.java | 59 + .../tuscany/sca/test/ConversationsCallback.java | 18 + .../tuscany/sca/test/ConversationsClient.java | 12 + .../tuscany/sca/test/ConversationsClient2.java | 11 + .../tuscany/sca/test/ConversationsClientImpl.java | 466 +++++++ .../sca/test/ConversationsLifeCycleService.java | 20 + .../test/ConversationsLifeCycleServiceImpl.java | 79 ++ .../tuscany/sca/test/ConversationsService.java | 24 + .../tuscany/sca/test/ConversationsServiceImpl.java | 134 ++ .../src/main/resources/ConversationsTest.composite | 48 + .../apache/tuscany/sca/test/ConversationsTest.java | 27 + .../testing/sca/itest/databindings/LICENSE.txt | 202 +++ .../testing/sca/itest/databindings/NOTICE.txt | 14 + .../sca/itest/databindings/common/LICENSE.txt | 202 +++ .../sca/itest/databindings/common/NOTICE.txt | 14 + .../testing/sca/itest/databindings/common/pom.xml | 120 ++ .../tuscany/sca/itest/generate/Generate.java | 130 ++ .../resources/generate/DatabindingTestCase.java.vm | 116 ++ .../src/main/resources/generate/Greeter.wsdl.vm | 103 ++ .../main/resources/generate/GreeterService.java.vm | 53 + .../generate/GreeterServiceClient.java.vm | 42 + .../generate/GreeterServiceClientImpl.java.vm | 65 + .../resources/generate/GreeterServiceImpl.java.vm | 55 + .../src/main/resources/generate/generate.xsd | 61 + .../common/src/main/resources/generate/pom.xml.vm | 181 +++ .../common/src/main/resources/wsdl/Dummy.wsdl | 4 + .../common/src/main/resources/xsd/Annotation.xml | 24 + .../common/src/main/resources/xsd/Annotation.xsd | 38 + .../common/src/main/resources/xsd/Attribute.xml | 24 + .../common/src/main/resources/xsd/Attribute.xsd | 38 + .../src/main/resources/xsd/AttributeReference.xml | 24 + .../src/main/resources/xsd/AttributeReference.xsd | 40 + .../resources/xsd/AttributeWithDefaultValue.xml | 24 + .../resources/xsd/AttributeWithDefaultValue.xsd | 38 + .../main/resources/xsd/AttributeWithFixedValue.xml | 24 + .../main/resources/xsd/AttributeWithFixedValue.xsd | 38 + .../resources/xsd/AttributeWithSDOAliasName.xml | 24 + .../resources/xsd/AttributeWithSDOAliasName.xsd | 38 + .../resources/xsd/AttributeWithSDODataType.xml | 24 + .../resources/xsd/AttributeWithSDODataType.xsd | 38 + .../main/resources/xsd/AttributeWithSDOName.xml | 24 + .../main/resources/xsd/AttributeWithSDOName.xsd | 38 + ...ibuteWithSDOPropertySDOOppositePropertyType.xml | 24 + ...ibuteWithSDOPropertySDOOppositePropertyType.xsd | 38 + .../resources/xsd/AttributeWithSDOPropertyType.xml | 24 + .../resources/xsd/AttributeWithSDOPropertyType.xsd | 38 + .../main/resources/xsd/AttributeWithSDOString.xml | 24 + .../main/resources/xsd/AttributeWithSDOString.xsd | 38 + .../main/resources/xsd/BuiltInAnySimpleType.xml | 24 + .../main/resources/xsd/BuiltInAnySimpleType.xsd | 31 + .../src/main/resources/xsd/BuiltInAnyType.xml | 24 + .../src/main/resources/xsd/BuiltInAnyType.xsd | 31 + .../src/main/resources/xsd/BuiltInAnyURI.xml | 24 + .../src/main/resources/xsd/BuiltInAnyURI.xsd | 31 + .../src/main/resources/xsd/BuiltInBase64Binary.xml | 24 + .../src/main/resources/xsd/BuiltInBase64Binary.xsd | 31 + .../src/main/resources/xsd/BuiltInBoolean.xml | 27 + .../src/main/resources/xsd/BuiltInBoolean.xsd | 31 + .../common/src/main/resources/xsd/BuiltInByte.xml | 25 + .../common/src/main/resources/xsd/BuiltInByte.xsd | 31 + .../common/src/main/resources/xsd/BuiltInDate.xml | 24 + .../common/src/main/resources/xsd/BuiltInDate.xsd | 31 + .../src/main/resources/xsd/BuiltInDateTime.xml | 24 + .../src/main/resources/xsd/BuiltInDateTime.xsd | 31 + .../src/main/resources/xsd/BuiltInDecimal.xml | 23 + .../src/main/resources/xsd/BuiltInDecimal.xsd | 31 + .../src/main/resources/xsd/BuiltInDouble.xml | 25 + .../src/main/resources/xsd/BuiltInDouble.xsd | 31 + .../src/main/resources/xsd/BuiltInDuration.xml | 24 + .../src/main/resources/xsd/BuiltInDuration.xsd | 31 + .../common/src/main/resources/xsd/BuiltInFloat.xml | 24 + .../common/src/main/resources/xsd/BuiltInFloat.xsd | 31 + .../common/src/main/resources/xsd/BuiltInGDay.xml | 24 + .../common/src/main/resources/xsd/BuiltInGDay.xsd | 31 + .../src/main/resources/xsd/BuiltInGMonth.xml | 24 + .../src/main/resources/xsd/BuiltInGMonth.xsd | 31 + .../src/main/resources/xsd/BuiltInGMonthDay.xml | 24 + .../src/main/resources/xsd/BuiltInGMonthDay.xsd | 31 + .../common/src/main/resources/xsd/BuiltInGYear.xml | 24 + .../common/src/main/resources/xsd/BuiltInGYear.xsd | 31 + .../src/main/resources/xsd/BuiltInGYearMonth.xml | 24 + .../src/main/resources/xsd/BuiltInGYearMonth.xsd | 31 + .../src/main/resources/xsd/BuiltInHexBinary.xml | 24 + .../src/main/resources/xsd/BuiltInHexBinary.xsd | 31 + .../common/src/main/resources/xsd/BuiltInID.xml | 24 + .../common/src/main/resources/xsd/BuiltInID.xsd | 31 + .../common/src/main/resources/xsd/BuiltInIDREF.xml | 24 + .../common/src/main/resources/xsd/BuiltInIDREF.xsd | 31 + .../src/main/resources/xsd/BuiltInIDREFS.xml | 24 + .../src/main/resources/xsd/BuiltInIDREFS.xsd | 31 + .../common/src/main/resources/xsd/BuiltInInt.xml | 25 + .../common/src/main/resources/xsd/BuiltInInt.xsd | 31 + .../src/main/resources/xsd/BuiltInInteger.xml | 25 + .../src/main/resources/xsd/BuiltInInteger.xsd | 31 + .../src/main/resources/xsd/BuiltInLanguage.xml | 24 + .../src/main/resources/xsd/BuiltInLanguage.xsd | 31 + .../common/src/main/resources/xsd/BuiltInLong.xml | 25 + .../common/src/main/resources/xsd/BuiltInLong.xsd | 33 + .../src/main/resources/xsd/BuiltInNCName.xml | 24 + .../src/main/resources/xsd/BuiltInNCName.xsd | 31 + .../src/main/resources/xsd/BuiltInNMTOKEN.xml | 24 + .../src/main/resources/xsd/BuiltInNMTOKEN.xsd | 31 + .../src/main/resources/xsd/BuiltInNMTOKENS.xml | 24 + .../src/main/resources/xsd/BuiltInNMTOKENS.xsd | 31 + .../src/main/resources/xsd/BuiltInNOTATION.xml | 24 + .../src/main/resources/xsd/BuiltInNOTATION.xsd | 39 + .../common/src/main/resources/xsd/BuiltInName.xml | 24 + .../common/src/main/resources/xsd/BuiltInName.xsd | 31 + .../main/resources/xsd/BuiltInNegativeInteger.xml | 24 + .../main/resources/xsd/BuiltInNegativeInteger.xsd | 31 + .../resources/xsd/BuiltInNonNegativeInteger.xml | 24 + .../resources/xsd/BuiltInNonNegativeInteger.xsd | 31 + .../resources/xsd/BuiltInNonPositiveInteger.xml | 24 + .../resources/xsd/BuiltInNonPositiveInteger.xsd | 31 + .../main/resources/xsd/BuiltInNormalizedString.xml | 24 + .../main/resources/xsd/BuiltInNormalizedString.xsd | 31 + .../main/resources/xsd/BuiltInPositiveInteger.xml | 24 + .../main/resources/xsd/BuiltInPositiveInteger.xsd | 31 + .../common/src/main/resources/xsd/BuiltInQName.xml | 24 + .../common/src/main/resources/xsd/BuiltInQName.xsd | 31 + .../common/src/main/resources/xsd/BuiltInShort.xml | 25 + .../common/src/main/resources/xsd/BuiltInShort.xsd | 31 + .../src/main/resources/xsd/BuiltInString.xml | 24 + .../src/main/resources/xsd/BuiltInString.xsd | 31 + .../common/src/main/resources/xsd/BuiltInTime.xml | 24 + .../common/src/main/resources/xsd/BuiltInTime.xsd | 31 + .../common/src/main/resources/xsd/BuiltInToken.xml | 24 + .../common/src/main/resources/xsd/BuiltInToken.xsd | 31 + .../src/main/resources/xsd/BuiltInUnsignedByte.xml | 25 + .../src/main/resources/xsd/BuiltInUnsignedByte.xsd | 31 + .../src/main/resources/xsd/BuiltInUnsignedInt.xml | 25 + .../src/main/resources/xsd/BuiltInUnsignedInt.xsd | 31 + .../src/main/resources/xsd/BuiltInUnsignedLong.xml | 25 + .../src/main/resources/xsd/BuiltInUnsignedLong.xsd | 31 + .../main/resources/xsd/BuiltInUnsignedShort.xml | 25 + .../main/resources/xsd/BuiltInUnsignedShort.xsd | 31 + ...lexTypeComplexContentRestrictingComplexType.xml | 26 + ...lexTypeComplexContentRestrictingComplexType.xsd | 44 + .../xsd/ComplexTypeExtendingComplexType.xml | 27 + .../xsd/ComplexTypeExtendingComplexType.xsd | 43 + .../xsd/ComplexTypeExtendingSimpleType.xml | 24 + .../xsd/ComplexTypeExtendingSimpleType.xsd | 41 + ...plexTypeSimpleContentRestrictingComplexType.xml | 24 + ...plexTypeSimpleContentRestrictingComplexType.xsd | 41 + .../main/resources/xsd/ComplexTypeWithAbstract.xml | 27 + .../main/resources/xsd/ComplexTypeWithAbstract.xsd | 47 + .../main/resources/xsd/ComplexTypeWithCDATA.xml | 30 + .../main/resources/xsd/ComplexTypeWithCDATA.xsd | 39 + .../main/resources/xsd/ComplexTypeWithContent.xml | 26 + .../main/resources/xsd/ComplexTypeWithContent.xsd | 37 + .../main/resources/xsd/ComplexTypeWithMixed.xml | 29 + .../main/resources/xsd/ComplexTypeWithMixed.xsd | 39 + .../xsd/ComplexTypeWithOpenAttributes.xml | 24 + .../xsd/ComplexTypeWithOpenAttributes.xsd | 42 + .../resources/xsd/ComplexTypeWithOpenContent.xml | 31 + .../resources/xsd/ComplexTypeWithOpenContent.xsd | 39 + .../xsd/ComplexTypeWithOppositeProperty.xml | 30 + .../xsd/ComplexTypeWithOppositeProperty.xsd | 59 + .../resources/xsd/ComplexTypeWithSDOAliasName.xml | 26 + .../resources/xsd/ComplexTypeWithSDOAliasName.xsd | 38 + .../main/resources/xsd/ComplexTypeWithSDOName.xml | 26 + .../main/resources/xsd/ComplexTypeWithSDOName.xsd | 38 + .../resources/xsd/ComplexTypeWithSDOSequence.xml | 26 + .../resources/xsd/ComplexTypeWithSDOSequence.xsd | 40 + .../resources/xsd/ComplexTypeWithoutContent.xml | 24 + .../resources/xsd/ComplexTypeWithoutContent.xsd | 33 + .../main/resources/xsd/ComplexTypeWithoutName.xml | 26 + .../main/resources/xsd/ComplexTypeWithoutName.xsd | 39 + .../src/main/resources/xsd/DefaultNamespace.xml | 23 + .../src/main/resources/xsd/DefaultNamespace.xsd | 32 + .../common/src/main/resources/xsd/ElementInAll.xml | 27 + .../common/src/main/resources/xsd/ElementInAll.xsd | 40 + .../src/main/resources/xsd/ElementInChoice.xml | 25 + .../src/main/resources/xsd/ElementInChoice.xsd | 48 + .../xsd/ElementOfSDOChangeSummaryType.xml | 29 + .../xsd/ElementOfSDOChangeSummaryType.xsd | 34 + .../xsd/ElementOfSimpleTypeWithDefault.xml | 24 + .../xsd/ElementOfSimpleTypeWithDefault.xsd | 31 + .../resources/xsd/ElementOfSimpleTypeWithFixed.xml | 24 + .../resources/xsd/ElementOfSimpleTypeWithFixed.xsd | 31 + .../xsd/ElementOfSimpleTypeWithSDODataType.xml | 24 + .../xsd/ElementOfSimpleTypeWithSDODataType.xsd | 33 + ...mentOfSimpleTypeWithSDOOppositePropertyType.xml | 24 + ...mentOfSimpleTypeWithSDOOppositePropertyType.xsd | 33 + .../xsd/ElementOfSimpleTypeWithSDOPropertyType.xml | 24 + .../xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd | 32 + .../xsd/ElementOfSimpleTypeWithSDOString.xml | 24 + .../xsd/ElementOfSimpleTypeWithSDOString.xsd | 32 + .../resources/xsd/ElementSubstitutionGroupBase.xml | 40 + .../resources/xsd/ElementSubstitutionGroupBase.xsd | 52 + .../main/resources/xsd/ElementWithMaxOccurs.xml | 25 + .../main/resources/xsd/ElementWithMaxOccurs.xsd | 31 + .../src/main/resources/xsd/ElementWithNillable.xml | 24 + .../src/main/resources/xsd/ElementWithNillable.xsd | 31 + .../main/resources/xsd/ElementWithSDOAliasName.xml | 24 + .../main/resources/xsd/ElementWithSDOAliasName.xsd | 32 + .../src/main/resources/xsd/ElementWithSDOName.xml | 24 + .../src/main/resources/xsd/ElementWithSDOName.xsd | 32 + .../resources/xsd/GlobalElementComplexType.xml | 24 + .../resources/xsd/GlobalElementComplexType.xsd | 31 + .../main/resources/xsd/GlobalElementSimpleType.xml | 24 + .../main/resources/xsd/GlobalElementSimpleType.xsd | 26 + .../common/src/main/resources/xsd/Import.xml | 30 + .../common/src/main/resources/xsd/Import.xsd | 40 + .../src/main/resources/xsd/ImportedSchema.xsd | 33 + .../common/src/main/resources/xsd/Include.xml | 24 + .../common/src/main/resources/xsd/Include.xsd | 36 + .../common/src/main/resources/xsd/Interop.xsd | 133 ++ .../common/src/main/resources/xsd/Notation.xml | 24 + .../common/src/main/resources/xsd/Notation.xsd | 35 + .../common/src/main/resources/xsd/Person.xsd | 30 + .../src/main/resources/xsd/SDOJavaPackage.xml | 25 + .../src/main/resources/xsd/SDOJavaPackage.xsd | 39 + .../main/resources/xsd/SimpleTypeWithAbstract.xml | 24 + .../main/resources/xsd/SimpleTypeWithAbstract.xsd | 40 + .../xsd/SimpleTypeWithExtendedInstanceClass.xml | 24 + .../xsd/SimpleTypeWithExtendedInstanceClass.xsd | 36 + .../resources/xsd/SimpleTypeWithInstanceClass.xml | 24 + .../resources/xsd/SimpleTypeWithInstanceClass.xsd | 37 + .../src/main/resources/xsd/SimpleTypeWithList.xml | 24 + .../src/main/resources/xsd/SimpleTypeWithList.xsd | 37 + .../src/main/resources/xsd/SimpleTypeWithName.xml | 24 + .../src/main/resources/xsd/SimpleTypeWithName.xsd | 36 + .../main/resources/xsd/SimpleTypeWithSDOName.xml | 24 + .../main/resources/xsd/SimpleTypeWithSDOName.xsd | 37 + .../src/main/resources/xsd/SimpleTypeWithUnion.xml | 25 + .../src/main/resources/xsd/SimpleTypeWithUnion.xsd | 46 + .../main/resources/xsd/SimpleTypeWithoutName.xml | 26 + .../main/resources/xsd/SimpleTypeWithoutName.xsd | 38 + .../src/main/resources/xsd/TargetNamespace.xml | 24 + .../src/main/resources/xsd/TargetNamespace.xsd | 34 + .../common/src/main/resources/xsd/datagraph.xsd | 88 ++ .../common/src/main/resources/xsd/sdoJava.xsd | 88 ++ .../common/src/main/resources/xsd/sdoModel.xsd | 221 +++ .../sca/itest/generate/GenerateTestCase.java | 52 + .../sca/itest/databindings/interop/LICENSE.txt | 202 +++ .../sca/itest/databindings/interop/NOTICE.txt | 14 + .../testing/sca/itest/databindings/interop/pom.xml | 200 +++ .../generate/InteropDatabindingTestCase.java.vm | 119 ++ .../main/resources/generate/JAXBGreeter.wsdl.vm | 103 ++ .../src/main/resources/generate/SDOGreeter.wsdl.vm | 103 ++ .../src/main/resources/generate/generate.xml | 100 ++ .../resources/generate/interopgreeter.composite.vm | 104 ++ .../testing/sca/itest/databindings/jaxb/pom.xml | 152 +++ .../sca/itest/jaxbdatabinding/GreeterService.java | 34 + .../jaxbdatabinding/GreeterServiceClient.java | 34 + .../jaxbdatabinding/GreeterServiceClientImpl.java | 48 + .../itest/jaxbdatabinding/GreeterServiceImpl.java | 44 + .../jaxb/src/main/resources/greeterws.composite | 67 + .../jaxb/src/main/resources/wsdl/Greeter.wsdl | 88 ++ .../jaxb/src/main/resources/xsd/Person.xsd | 30 + .../tuscany/sca/itest/JaxbDatabindingTestCase.java | 85 ++ .../sca/itest/databindings/jaxbgen/LICENSE.txt | 202 +++ .../sca/itest/databindings/jaxbgen/NOTICE.txt | 14 + .../testing/sca/itest/databindings/jaxbgen/pom.xml | 188 +++ .../src/main/resources/generate/generate.xml | 113 ++ .../jaxbgen/src/main/resources/greeter.composite | 68 + .../testing/sca/itest/databindings/pom.xml | 47 + .../testing/sca/itest/databindings/sdo/pom.xml | 148 ++ .../sca/itest/sdodatabinding/GreeterService.java | 34 + .../itest/sdodatabinding/GreeterServiceClient.java | 34 + .../sdodatabinding/GreeterServiceClientImpl.java | 47 + .../itest/sdodatabinding/GreeterServiceImpl.java | 52 + .../sdo/src/main/resources/greetersdo.composite | 70 + .../sdo/src/main/resources/wsdl/Greeter.wsdl | 80 ++ .../sdo/src/main/resources/xsd/Person.xsd | 30 + .../tuscany/sca/itest/SdoDatabindingTestCase.java | 88 ++ .../sca/itest/databindings/sdogen/LICENSE.txt | 202 +++ .../sca/itest/databindings/sdogen/NOTICE.txt | 14 + .../testing/sca/itest/databindings/sdogen/pom.xml | 183 +++ .../src/main/resources/generate/generate.xml | 114 ++ .../main/resources/generate/greeter.composite.vm | 75 ++ .../sca/itest/databindings/transformers/.ruleset | 172 +++ .../itest/databindings/transformers/LICENSE.txt | 202 +++ .../sca/itest/databindings/transformers/NOTICE.txt | 14 + .../sca/itest/databindings/transformers/pom.xml | 221 +++ .../apache/tuscany/databinding/JAXBTestCase.java | 119 ++ .../databinding/TransformationTestCase.java | 249 ++++ .../tuscany/databinding/XmlObjectTestCase.java | 110 ++ .../apache/tuscany/databinding/sample/Client.java | 26 + .../tuscany/databinding/sample/ClientImpl.java | 50 + .../sample/DataBindingBootStrapTestCase.java | 124 ++ .../apache/tuscany/databinding/sample/Echo.java | 42 + .../tuscany/databinding/sample/EchoImpl.java | 43 + .../src/test/resources/DataBindingTest.composite | 34 + .../transformers/src/test/resources/ipo.xml | 33 + .../transformers/src/test/resources/ipo.xsd | 118 ++ .../transformers/src/test/resources/ipo.xsdconfig | 21 + .../itest/exceptions-crossBinding-ws/LICENSE.txt | 202 +++ .../itest/exceptions-crossBinding-ws/NOTICE.txt | 14 + .../sca/itest/exceptions-crossBinding-ws/pom.xml | 189 +++ .../exceptions/impl/StockExceptionTestJAXB.java | 33 + .../test/exceptions/impl/StockExchangeJaxB.java | 76 ++ .../sca/test/exceptions/impl/StockTraderSDO.java | 37 + .../test/exceptions/impl/StockTraderSDOImpl.java | 122 ++ .../sdohandgen/InvalidSymbolSDOException.java | 84 ++ .../sdohandgen/MarketClosedSDOException.java | 76 ++ .../exceptions/sdohandgen/StockExceptionTest.java | 50 + .../src/main/resources/ExceptionTest.composite | 26 + .../src/main/resources/intracomposite.composite | 42 + .../resources/wsdl.sdo/StockExceptionTest.wsdl | 141 ++ .../main/resources/wsdl/StockExceptionTest.wsdl | 148 ++ .../src/main/resources/xsd/StockExceptionTest.xsd | 65 + .../test/exceptions/IntraCompositeTestCase.java | 97 ++ .../sca/itest/exceptions-crossBinding/LICENSE.txt | 202 +++ .../sca/itest/exceptions-crossBinding/NOTICE.txt | 14 + .../sca/itest/exceptions-crossBinding/pom.xml | 161 +++ .../exceptions/impl/StockExceptionTestJAXB.java | 33 + .../test/exceptions/impl/StockExchangeJaxB.java | 76 ++ .../sca/test/exceptions/impl/StockTraderSDO.java | 37 + .../test/exceptions/impl/StockTraderSDOImpl.java | 122 ++ .../sdohandgen/InvalidSymbolSDOException.java | 84 ++ .../sdohandgen/MarketClosedSDOException.java | 76 ++ .../exceptions/sdohandgen/StockExceptionTest.java | 50 + .../src/main/resources/ExceptionTest.composite | 26 + .../src/main/resources/intracomposite.composite | 35 + .../resources/wsdl.sdo/StockExceptionTest.wsdl | 141 ++ .../main/resources/wsdl/StockExceptionTest.wsdl | 148 ++ .../src/main/resources/xsd/StockExceptionTest.xsd | 65 + .../test/exceptions/IntraCompositeTestCase.java | 97 ++ .../testing/sca/itest/exceptions/LICENSE.txt | 202 +++ .../testing/sca/itest/exceptions/NOTICE.txt | 14 + .../testing/sca/itest/exceptions/pom.xml | 32 + .../tuscany/sca/test/exceptions/Checked.java | 57 + .../sca/test/exceptions/ExceptionHandler.java | 32 + .../sca/test/exceptions/ExceptionThrower.java | 31 + .../tuscany/sca/test/exceptions/UnChecked.java | 56 + .../test/exceptions/impl/ExceptionHandlerImpl.java | 120 ++ .../test/exceptions/impl/ExceptionThrowerImpl.java | 63 + .../src/main/resources/ExceptionTest.composite | 26 + .../src/main/resources/intracomposite.composite | 33 + .../test/exceptions/IntraCompositeTestCase.java | 57 + .../sca/itest/operation-overloading/LICENSE.txt | 202 +++ .../sca/itest/operation-overloading/NOTICE.txt | 14 + .../sca/itest/operation-overloading/pom.xml | 43 + .../sca/test/opoverload/OverloadASourceTarget.java | 43 + .../sca/test/opoverload/impl/OverloadASource.java | 105 ++ .../sca/test/opoverload/impl/OverloadATarget.java | 96 ++ .../opoverload/interceptor/MessageInterceptor.java | 114 ++ .../MessageInterceptorWirePostProcessor.java | 122 ++ .../resources/META-INF/sca/application.composite | 34 + .../opoverload/interceptor/MessageInterceptor.scdl | 27 + .../test/opoverload/impl/OverloadATestCase.java | 78 ++ .../sca-java-integration/testing/sca/itest/pom.xml | 135 ++ .../testing/sca/itest/property/pom.xml | 34 + .../apache/tuscany/sca/itest/ABCDComponent.java | 27 + .../tuscany/sca/itest/ABCDComponentImpl.java | 55 + .../org/apache/tuscany/sca/itest/ABComponent.java | 33 + .../apache/tuscany/sca/itest/ABComponentImpl.java | 98 ++ .../org/apache/tuscany/sca/itest/CDComponent.java | 33 + .../apache/tuscany/sca/itest/CDComponentImpl.java | 97 ++ .../tuscany/sca/itest/ComplexPropertyBean.java | 69 + .../apache/tuscany/sca/itest/OverrideService.java | 25 + .../tuscany/sca/itest/OverrideServiceImpl.java | 24 + .../tuscany/sca/itest/PropertyComponent.java | 32 + .../tuscany/sca/itest/PropertyComponentImpl.java | 72 + .../apache/tuscany/sca/itest/PropertyService.java | 24 + .../src/main/resources/PropertyTest.composite | 197 +++ .../property/src/main/resources/fileProperty.txt | 1 + .../src/main/resources/manyValuesFileProperty.txt | 6 + .../apache/tuscany/sca/itest/PropertyTestCase.java | 186 +++ .../testing/sca/itest/spec/pom.xml | 34 + .../tuscany/sca/test/spec/MyListService.java | 28 + .../tuscany/sca/test/spec/MyListServiceByYear.java | 27 + .../apache/tuscany/sca/test/spec/MyService.java | 29 + .../tuscany/sca/test/spec/MyServiceByDate.java | 29 + .../tuscany/sca/test/spec/MyTotalService.java | 23 + .../tuscany/sca/test/spec/SCAComponentService.java | 28 + .../sca/test/spec/impl/MyListServiceImpl.java | 73 + .../tuscany/sca/test/spec/impl/MyServiceImpl.java | 122 ++ .../sca/test/spec/impl/MyTotalServiceImpl.java | 83 ++ .../src/main/resources/CompositeTest.composite | 33 + .../src/main/resources/myListService.composite | 32 + .../main/resources/myServiceInComposite.composite | 53 + .../main/resources/myServiceInRecursive.composite | 53 + .../src/main/resources/mySimpleService.composite | 35 + .../resources/mySimpleServiceInRecursive.composite | 48 + .../mySimpleServiceInRecursive2.composite | 47 + .../src/main/resources/myTotalService.composite | 32 + .../resources/myTotalServiceInComposite.composite | 43 + ...erviceInCompositeForReferenceOverride.composite | 81 ++ .../resources/myTotalServiceInRecursive.composite | 62 + ...erviceInRecursiveForReferenceOverride.composite | 55 + .../spec/src/main/resources/myservice.composite | 51 + .../ComponentServiceReferenceListTestCase.java | 53 + .../spec/ComponentServiceReferenceTestCase.java | 88 ++ .../tuscany/sca/test/spec/ComponentTestCase.java | 110 ++ .../spec/CompositeOneService2LevelTestCase.java | 191 +++ .../sca/test/spec/CompositeOneServiceTestCase.java | 84 ++ ...siteServiceReferenceForRefOverrideTestCase.java | 83 ++ .../spec/CompositeServiceReferenceTestCase.java | 95 ++ .../tuscany/sca/test/spec/CompositeTestCase.java | 96 ++ .../testing/sca/itest/wsdl/pom.xml | 135 ++ .../services/accountdata/AccountDataService.java | 95 ++ .../accountdata/AccountDataServiceImpl.java | 80 ++ .../accountdata/AccountServiceClientImpl.java | 80 ++ .../services/accountdata/Component2aImpl.java | 80 ++ .../services/accountdata/Component2bImpl.java | 80 ++ .../services/accountdata/Component3aImpl.java | 80 ++ .../services/accountdata/Component3bImpl.java | 80 ++ .../services/accountdata/CustomerIdService.java | 98 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../main/java/helloworld/HelloWorldService.java | 33 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../apache/tuscany/sca/itest/Component2aImpl.java | 38 + .../apache/tuscany/sca/itest/Component2bImpl.java | 39 + .../apache/tuscany/sca/itest/Component3aImpl.java | 39 + .../apache/tuscany/sca/itest/Component3bImpl.java | 39 + .../wsdl/src/main/resources/SDOWSDLTest.composite | 402 ++++++ .../wsdl/src/main/resources/WSDLTest.composite | 412 ++++++ .../accountdata/Component2bImpl.componentType | 10 + .../accountdata/Component3bImpl.componentType | 10 + .../sca/itest/Component2bImpl.componentType | 10 + .../sca/itest/Component3bImpl.componentType | 10 + .../src/main/resources/wsdl/AccountService.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1a2a3a4a.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1a2a3a4b.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1a2a3b4a.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1a2a3b4b.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1a2b3a4a.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1a2b3a4b.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1a2b3b4a.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1a2b3b4b.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1b2a3a4a.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1b2a3a4b.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1b2a3b4a.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1b2a3b4b.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1b2b3a4a.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1b2b3a4b.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1b2b3b4a.wsdl | 467 +++++++ .../resources/wsdl/AccountServiceC1b2b3b4b.wsdl | 467 +++++++ .../wsdl/src/main/resources/wsdl/helloworld.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1a2a3a4a.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1a2a3a4b.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1a2a3b4a.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1a2a3b4b.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1a2b3a4a.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1a2b3a4b.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1a2b3b4a.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1a2b3b4b.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1b2a3a4a.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1b2a3a4b.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1b2a3b4a.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1b2a3b4b.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1b2b3a4a.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1b2b3a4b.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1b2b3b4a.wsdl | 80 ++ .../main/resources/wsdl/helloworldC1b2b3b4b.wsdl | 80 ++ .../apache/tuscany/sca/itest/SDOWSDLTestCase.java | 97 ++ .../org/apache/tuscany/sca/itest/WSDLTestCase.java | 149 +++ .../sca-java-integration/testing/sca/pom.xml | 165 +++ 2575 files changed, 243770 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-integration/buildtools/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/buildtools/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/buildtools/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/buildtools/src/main/resources/tuscany-checkstyle.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/buildtools/src/main/resources/tuscany-suppressions.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/pom/parent/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/.pmd create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerDataServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/DasAccountConfiguration.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/wsdl/AccountService.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/webapp/WEB-INF/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/test/java/bigbank/account/client/AccountClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/Show.Image.html create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/accountfiles.png create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/accountmodule.png create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/modualoverview.png create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/webclientfiles.png create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/webclientmodule.png create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/readme.html create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/.pmd create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/account/AccountServiceComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/AccountLoginServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/LoginService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountLogTag.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountStatusTag.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockLogTag.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockStatusTag.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/LoginBarrierTag.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/ServiceTag.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/ui/FormServlet.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/ui/LoginServlet.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/CustomerProfile.jsp create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/accountLog.jsp create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/accountTransaction.jsp create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/login.html create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/purchaseStock.jsp create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/stockSale.jsp create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/summary.jsp create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/test/java/bigbank/webclient/client/TestAccountService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/test/java/bigbank/webclient/client/TestLoginService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/readme.html create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/AddService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/AddServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/DivideService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/DivideServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/MultiplyService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/SubtractService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/Calculator.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/test/java/calculator/CalculatorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/CompositeClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/Source.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/SourceCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/SourceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/Target.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/TargetImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite2.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/OuterComposite.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/test/java/composite/CompositeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBindingLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoReference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/resources/META-INF/sca/extension.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Client.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/ClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Echo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/EchoBindingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBindingLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoReference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/resources/META-INF/sca/extension.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/ComponentAImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/ComponentBImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Echo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/EchoDataBindingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Interface1.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Interface2.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/EchoDataBinding.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/wsdl/echo.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanApplication.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/resources/loanapplication.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountReport.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/Account.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/BigBank.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyServiceCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/resources/simplecallback.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/readme.htm create mode 100755 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/run.bat create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Customer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/CustomerComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Retailer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/RetailerComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Shipper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/ShipperComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/SupplyChainClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Warehouse.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/supplychain.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/WEB-INF/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/calc.jsp create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/NOTICE.txt create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/assembly/axis2.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/binding.axis2.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/extension.composite create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/GreetingCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/WebServicebindingLoaderTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/.ruleset create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/NOTICE.txt create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomDataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomHelper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2Object.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2String.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2XMLStreamReader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/Object2OMElement.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/XMLStreamReader2OMElement.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/databinding.axiom.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/extension.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandlerTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/OMElementTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xml create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/order.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleReference.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleService.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/OldStyleTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/client.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/service.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceExplicitURITestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/client.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/service.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceRelativeURITestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/client.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/service.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/SimplestTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/client.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/service.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/WsdlElementBindingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/readme.html create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/resources/calculator.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/calc.jsp create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/index.html create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/readme.htm create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/setup.bat create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/webapp.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run.bat create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run_celtix.bat create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldLocal.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/logging.properties create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/readme.htm create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/setup.bat create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldServer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/helloworldws-om.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/wsdl/helloworld-om.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/test/java/helloworld/om/HelloWorldServerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/pom.xml create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/run.bat create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldServiceComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/logging.properties create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/wsdl/helloworld-om.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldClientTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldServerTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/resources/wsdl/greeter.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/webapp.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterLocal.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/wsdl/greeter.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/java/greeter/GreeterWSOneWayClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldServer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/helloworldws.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/system.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/test/java/helloworld/HelloWorldServerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/logging.properties create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldClientTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldServerTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanApplication.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/resources/wsdl/loanappconversation.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanAppConversationClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanApplication.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/wsdl/loanappconversation.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/test/java/loanappconversation/LoanAppConversationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/AccountService.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/interopdoc.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/sequences.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/AccountService.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/interopdoc.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/sequences.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/DefaultOperationAndDataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSReferenceBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSResourceFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSServiceBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSTargetInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/OperationAndDataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/SimpleJMSResourceFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/AbstractJmsTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/Input2JmsInputTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsInput2InputTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsOutput2OutputTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/Output2JmsOutputTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/binding.jms.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/extension.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/GreetingService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/GreetingServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/HelloworldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/HelloworldServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/IntroService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/IntroServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSBindingTestCaseX.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSProxyTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/databinding/JmsTransformerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/test/java/helloworld/HelloWorldJmsClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/test/java/helloworld/HelloWorldJmsServer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingDefinition.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServlet.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCServiceBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServlet.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/util/JavaToSmd.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/binding.jsonrpc.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/extension.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/org/apache/tuscany/binding/jsonrpc/jsonrpc.js create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServletTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCServiceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServletTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/TestInterface.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/util/JavaToSmdTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/build.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/java/helloworldjsonrpc/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/HelloWorldJSONRPC.html create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/WEB-INF/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/style.css create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/.ruleset create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentTypeLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationJavaScriptLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationPythonLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationRubyLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstance.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/extension.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/script.system.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentBuilderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderLoadingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/foo.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/foo.mock create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2OMElement.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XWrapperHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/OMElement2E4X.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/databinding.e4x.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/extension.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/calculator/CalculatorService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/calculator/DivideService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/helloworld.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/properties.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/references.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/xml.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.py create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.rb create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.py create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.rb create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/sample.calculator.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.groovy create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.js create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.py create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.rb create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.js create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.py create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.rb create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.js create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.py create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.rb create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.js create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.py create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.rb create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.js create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.js create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.js create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/calculator/CalculatorClientTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/HelloWorldClientTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/JavaScriptPropertiesTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/PythonPropertiesTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/ReferencesTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/RubyPropertiesTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/XMLTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/extensions/script/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.checkstyle create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.pmd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCARuntime.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/TuscanyException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/TuscanyRuntimeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/DataType.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/IDLMapping.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/LogLevel.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/Monitor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/Resource.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/test/java/org/apache/tuscany/api/TuscanyExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/test/java/org/apache/tuscany/api/TuscanyRuntimeExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.checkstyle create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.pmd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/Bootstrapper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultRuntime.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultSCARuntime.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IllegalCallbackException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/InvalidTargetTypeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoCompatibleBindingsException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoConversationalContractException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoRegisteredBuilderException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/TargetServiceNotFoundException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WireConnectException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WiringExceptionFormatter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ScopeIdentifier.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/AbstractEvent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/AbstractRequestEvent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeEvent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeStart.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeStop.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationEnd.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationStart.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationalEvent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpRequestEnded.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpRequestStart.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEnd.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEvent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionStart.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestEnd.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestEvent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestStart.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/AbstractScopeContainer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ScopeRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingInteceptor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataTypeLoader.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DirectedGraph.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Exception2ExceptionTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Group2GroupTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/GroupDataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Input2InputTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/MediatorImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Output2OutputTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueInterceptor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PipedTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/SimpleDataBinding.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/TransformationContextImpl.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/TransformerRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/DOMNode2JavaBeanTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/Java2XMLMapperException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2DOMNodeTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2XMLStreamReader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2XMLTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBeansDataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/XML2JavaBeanTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/XML2JavaMapperException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/BeanUtil.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMDataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMWrapperHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMXMLStreamReader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DelegatingNamespaceContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputSource2Node.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputSource2SAX.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputStream2Node.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputStream2SAX.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NameValueArrayStreamReader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NameValuePairStreamReader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NamedProperty.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NilElementStreamReader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2OutputStream.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2String.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2Writer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2XMLStreamReader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Reader2Node.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Reader2SAX.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/SAX2DOM.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/SAX2DOMPipe.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Source2ResultTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAX2SAXAdapter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAXDataBinding.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAXHelper.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StreamDataPipe.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2Node.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2SAX.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2XMLStreamReader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/WrappingXMLStreamReader.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Writer2ReaderDataPipe.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLDocumentStreamReader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLFragmentStreamReader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLFragmentStreamReaderImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLGroupDataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2Node.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2SAX.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2String.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamSerializer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamable.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStringDataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/IllegalCallbackException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/InterfaceJavaLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/IntrospectionRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/Dependency.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ImplementationCompositeLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemCompositeBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaImplementation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaImplementationLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/AllowsPassByReferenceProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/AmbiguousConstructorException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConversationProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DestroyProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateConstructorException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateDestructorException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateInitException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateReferenceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateResourceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/EagerInitProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/HeuristicPojoProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalCallbackReferenceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalContextException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalDestructorException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalInitException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalReferenceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalResourceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalServiceDefinitionException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InitProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidAutowireException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidConstructorException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidConversationalImplementation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidPropertyException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidReferenceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidResourceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidServiceType.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/MonitorProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/NoConstructorException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/PropertyProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ResourceProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ScopeProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ServiceProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ServiceTypeNotFoundException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/UnknownContextTypeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemCompositeComponentTypeLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemImplementationLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemCompositeImplementation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ArrayMultiplicityObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ContextInjector.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ConversationIDObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/Injector.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InvalidAccessorException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InvalidResourceTypeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/JNDIListObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/JNDIObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ListMultiplicityObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoAccessorException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoMultiplicityTypeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/RequestContextObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ResourceNotFoundException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ResourceObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/SingletonListObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/CompositeContextImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LaunchException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherRuntimeInfo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentTypeElementLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/DefaultPropertyValueLoaderException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/DependencyLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/JNDIPropertyFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/LoaderExceptionFormatter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/LoaderRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ManyPropertyValueLoaderException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/MissingTypePropertyLoaderException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PolicySetLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PropertyLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PropertyLoaderException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ReferenceLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/StringParserPropertyFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/WireLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/ComponentDefinitionMarshaller.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/InvalidLevelException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/MonitorFactoryUtil.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/IntentRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyBuilderRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyEngineImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyHelper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/PropertyHelper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/PropertyObjectFactoryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimpleMultivaluedPropertyObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimplePropertyObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntime.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeInfo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeInfoImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/artifact/LocalMavenRepository.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ArtifactResolverRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionDirectoryWatcher.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionProcessorRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionRepositoryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/DomainUpdateException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/InvalidContributionMetadataException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/InvalidDocumentException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/XMLChangeSetHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/CompositeContributionProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidComponentDefinitionlException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidFolderContributionURIException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidPojoComponentDefinitionlException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/MetadataContributionProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/resolver/ComponentDefinitionArtifactResolver.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/extension/AbstractExtensionDeployer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/host/DelegatingResourceHostRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/store/memory/MemoryStore.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jca/JcaWorkScheduler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkScheduler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/DefaultWorkEvent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/DefaultWorkItem.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/ThreadPoolWorkManager.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/test/SCATestCaseRunner.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/ClassLoaderHelper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/FileHelper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/IOHelper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/JavaIntrospectionHelper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/ReferenceLoaderHelper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/BridgingInterceptor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundInvocationChainImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvokerInterceptor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/LoopBackWire.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NoMethodForOperationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundInvocationChainImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/SynchronousBridgingInterceptor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireServiceExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireUtils.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/META-INF/tuscany/default-system.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/composite.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/databinding.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/deployment.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/formatters.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/implementation.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/interfaceJava.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/javaImplementation.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/loader.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/systemImplementation.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvokerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingBuilderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerThrowableTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalTargetInvokerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/bootstrap/BootstrapperTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AbstractConnectorImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AtomicConnectorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryNoBindingsTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorPostProcessTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/IllegalCallbackExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InboundtoOutboundConnectTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/IncompatibleInterfacesExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InvalidTargetTypeExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/LocalReferenceWiringTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/NonBlockingForwardNonBlockingCallbackConnectionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/NonBlockingForwardSyncCallbackConnectionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ReferenceConnectorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ServiceConnectorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/SynchronousForwardCallbackConnectionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/TargetServiceNotFoundExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/WiringExceptionFormatterTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/WorkContextImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicCompositeScopeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicConversationalScopeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInitDestroyErrorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInstanceLifecycleTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeObjectFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeRestartTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerDestroyOnExpirationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxAgeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxIdleTimeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerPersistenceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeInstanceLifecycleTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeRestartTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/DependencyLifecycleTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInitDestroyErrorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInstanceLifecycleTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeRestartTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/MockFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeInitDestroyErrorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeInstanceLifecycleTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeRestartTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ScopeRegistryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/StatelessScopeContainerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/StatelessScopeObjectFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/WorkContextTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingInterceptorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingRegistryImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorOptimizationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DirectedGraphTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/IDLTransformerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/MediatorImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueInterceptorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/TransformerRegistryImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/javabeans/DOMNode2JavaBeanTransformerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2DOMNodeTransformerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DOM2StAXTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DataPipeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/JavaBean2XMLStreamReaderTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/Node2StringTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/PushTransformationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/StAXHelperTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/TraxTransformerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/deployer/BootstrapDeployerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/ConversationalIntrospectionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/IntrospectionRegistryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/PojoAtomicComponentTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/TestUtils.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/AutowireResolutionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/AutowireTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeBuilderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplBasicTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplSystemWireTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentResolutionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeLifecycleTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeLoaderWireResolutionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositePropagationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/DuplicateRegistrationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ImplementationCompositeLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/JavaObjectRegistrationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContextTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ReferenceImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ServiceImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/SystemComponentBuilderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponentTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponentMetadataInjectionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponentNegativeMetadataTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaBuilderPropertyTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderConversationIDTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderMetadataTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderReferenceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderResourceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaReferenceWireTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerBasicInvocationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerMediationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerNonBlockingInvocationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerSequenceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerStatelessDestroyTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/MultiplicityTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/ResourceInjectionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/CallbackInvocationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/OutboundWireToJavaTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/AllowsPassByReferenceProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorAutowireTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessorExtensibilityTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorPropertyTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorReferenceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorResourceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ContextProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConversationProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConvertTimeMillisTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/DestroyProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/EagerInitProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicAndPropertyTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicConstructorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicPojoProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeutisticExtensibleConstructorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceUniqueTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/InitProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/MonitorProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/PropertyProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ResourceProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ScopeProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilderResourceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentWireInvocationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemImplementationLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/CallbackWireObjectFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/FieldInjectorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/JNDIObjectFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/MethodEventInvokerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/MethodInjectorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/PojoObjectFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/RequestContextObjectFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/ResourceObjectFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/SingletonObjectFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/AbstractConversationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/IntrospectionRegistryIntegrationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/system/builder/SystemBuilderPropertyTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/scope/ScopeReferenceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/DifferentInterfaceWireTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/ReferenceInjectionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/oneway/OneWayWireToJavaInvocationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderNoBindingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderPropertyTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderReferenceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderValidationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentReferenceOverridingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentTypeElementLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/DependencyLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/IncludeLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/JNDIPropertyFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/LoaderExceptionFormatterTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/MultivaluePropertyLoadingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PolicySetLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyParsingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ReferenceLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ServiceLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/StAXLoaderRegistryImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/StringParserPropertyFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/WireLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/binding/MockServiceBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/AsyncTarget.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BadContextPojo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BadNamePojo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BasicInterface.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BasicInterfaceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeDestroyOnlyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitDestroyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitOnlyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeDestroyOnlyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitDestroyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitOnlyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojoImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedEagerInitPojo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojoImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OtherTarget.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OtherTargetImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeDestroyOnlyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitDestroyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitOnlyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitDestroyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitOnlyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SimpleTarget.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SimpleTargetImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/Source.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/Target.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockStaticInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockSyncInterceptor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockTargetInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatterTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/monitor/JavaLoggingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/policy/IntentRegistryImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/policy/PolicyEngineImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/PropertyHelperTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/SimplePropertyObjectFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/artifact/LocalMavenRepositoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionRepositoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionServiceImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/CompositeContributionProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/host/DelegatingResourceHostRegistryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/store/memory/MemoryStoreTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkSchedulerTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkSchedulerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/workmanager/ThreadPoolWorkManagerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/Bean1.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/Bean2.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/JavaIntrospectionHelperTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/SuperBean.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InboundInvocationErrorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatterTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationChainImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundWireTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/SynchronousBridgingInterceptorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireServiceExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerSerializationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerSerializationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKProxyTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/deployables/sample-calculator.jar create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/impl/ipo.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/impl/order.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/xml/foo.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot1-include.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/loader/TestPolicy.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/loader/test-include.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/policy/PolicySet.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/property/ipo.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/services/deployment/test.ext create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/services/deployment/test.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/repository/sample-calculator.jar create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.checkstyle create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.pmd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/AbstractRuntimeInfo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/MonitorFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/RuntimeInfo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/AssemblyService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContentTypes.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionProcessorException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/DeploymentException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/UnsupportedContentTypeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/launcher/Launcher.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/management/ManagementService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/monitor/ExceptionFormatter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/monitor/FormatterRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHost.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostAdmin.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostRuntimeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/InitializationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/ShutdownException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/servlet/ServletRequestInjector.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/test/java/org/apache/tuscany/host/rmi/RMIHostExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/test/java/org/apache/tuscany/host/rmi/RMIHostRuntimeExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.checkstyle create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.pmd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/doc/Context Model.emx create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/AbstractLifecycle.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/CoreRuntimeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/InvalidNameException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/Lifecycle.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectCreationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/QualifiedName.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/annotation/Autowire.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/RuntimeComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindingBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Builder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderConfigException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderInstantiationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ComponentBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Connector.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/GenericBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/InvalidServiceInterfaceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/MissingWireTargetException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ScopeNotFoundException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WiringException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AtomicComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Component.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRegistrationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRuntimeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/DuplicateNameException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/IllegalTargetException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidAutowireInterface.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidConversationSequenceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/PersistenceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/PrepareException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReactivationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReferenceBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAExternalizable.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStartException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStopException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeContainer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeContainerMonitor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ServiceBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetDestructionException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInitializationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvocationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvokerCreationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetNotFoundException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetResolutionException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/WorkContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataBindingRegistry.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataPipe.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/ExceptionHandler.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/Mediator.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/PullTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/PushTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/SimpleTypeMapper.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformationContext.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformationException.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/Transformer.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformerRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/WrapperHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/DOMHelper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/DataBindingExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/Java2SimpleTypeTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/SimpleType2JavaTransformer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/SimpleTypeMapperExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/TransformerExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ArtifactResolver.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ArtifactResolverRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ChangeSetHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ChangeSetHandlerRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/CompositeClassLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContentType.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContentTypeDescriber.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionProcessorRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionRepository.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentMonitor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/AbstractEventPublisher.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/Event.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventFilter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventPublisher.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/RuntimeEventListener.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/TrueFilter.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AbstractComponentExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ArtifactResolverExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/BindingBuilderExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentBuilderExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ContributionProcessorExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ExecutionMonitor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/GenericBuilderExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/LoaderExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceHost.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceHostRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceResolutionException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ServletHost.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ElementInfo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidConversationalOperationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidServiceContractException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/OverloadedOperationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ServiceFaultException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/TypeInfo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/XMLType.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/InterfaceJavaIntrospector.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaIDLUtils.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessorExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessorRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaServiceContract.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ConstructorDefinition.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/DuplicatePropertyException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/IllegalPropertyException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/IntrospectionRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Introspector.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedComponentType.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedProperty.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedReference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ProcessingException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Resource.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ComponentTypeLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/DuplicateReferenceNameException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/IncompatibleOverridingServiceContractException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidConfigurationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidPromotedReferenceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidReferenceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidServiceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidValueException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidWireException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/Loader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderUtil.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingImplementationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingIncludeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingMustOverridePropertyException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingPropertyValueException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingReferenceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingResourceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingSideFileException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/NotOverridablePropertyException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/PropertyObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ReferenceMultiplicityOverridingException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ReferenceMultiplicityViolationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/StAXElementLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UndefinedPropertyException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UndefinedReferenceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UnrecognizedComponentTypeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UnrecognizedElementException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/MarshalException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshaller.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/AbstractReferenceDefinition.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/AtomicImplementation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/BindingDefinition.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentReferenceDefinition.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentTypeReferenceDefinition.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeImplementation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeReferenceDefinition.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Contribution.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ContributionImport.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DeployedArtifact.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Implementation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Include.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Intent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/IntentMap.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/IntentName.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/InteractionScope.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ModelObject.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Multiplicity.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/OverrideOptions.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyAttachable.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyAttachableModel.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyContentModel.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyModel.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Property.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PropertyValue.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceTarget.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Scope.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceDefinition.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WireDefinition.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WrapperInfo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyBuilderRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyEngine.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicySetContainer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SCATypeManager.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SourcePolicyBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SourcePolicyBuilderExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/TargetPolicyBuilder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/TargetPolicyBuilderExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolutionException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/Resolver.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolverRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/VoidService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/Artifact.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/ArtifactRepository.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/AbstractDiscoveryService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/DiscoveryException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/DiscoveryService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/RequestListener.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/ResponseListener.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/management/TuscanyManagementService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/DuplicateRecordException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/RecoveryListener.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/Store.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreExpirationEvent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreMonitor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreReadException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreWriteException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/NotificationListener.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/WorkScheduler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/WorkSchedulerException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/SCAObjectInputStream.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/stax/StaxUtil.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundInvocationChain.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Interceptor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationRuntimeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageId.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundChainHolder.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundInvocationChain.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/ProxyCreationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/TargetInvoker.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireInvocationHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireObjectFactory.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessorExtension.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessorRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/AssertionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/QualifiedNameTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/annotation/ConstructorAnnotationTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/DOMHelperTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/DataBindingExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/SimpleTypeMapperExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/TransformerExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverterTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/event/AbstractEventPublisherTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/AtomicComponentExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionSequenceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/idl/java/JavaIDLUtilsTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/CompositeComponentTypeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/OperationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ScopeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/policy/SourcePolicyBuilderExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/policy/TargetPolicyBuilderExtensionTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/MockSCAExternalizable.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/MockSerializable.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/SCAObjectInputStreamTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/stax/StaxUtilTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandlerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandlerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/OutboundChainHolderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/resources/test.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/.ruleset create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/NOTICE.txt create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/pom.xml create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXB2Node.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBContextHelper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBDataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXWSJavaInterfaceProcessor.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/Node2JAXB.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/Reader2JAXB.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/XMLStreamReader2JAXB.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/databinding.jaxb.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/extension.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault_Exception.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/resources/ipo.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSON2XMLStreamReader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSONDataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamReader2JSON.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamSerializer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSON2OMElement.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONBadgerfishDataSource.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONDataSource.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/resources/META-INF/sca/databinding.json.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/resources/META-INF/sca/extension.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/test/java/org/apache/tuscany/databinding/json/JSONTransformerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/test/resources/ipo.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/.checkstyle create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/DataObject2OMElement.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/DataObjectSerializer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/SDODataSource.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/XMLDocument2OMElement.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/resources/META-INF/sca/databinding.sdo-axiom.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/resources/META-INF/sca/extension.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/DataObject2OMElementTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/MockTransformationContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/SDOTransformerTestCaseBase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/XMLDocument2OMElementTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/resources/ipo.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/resources/stock.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/.checkstyle create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/.ruleset create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/NOTICE.txt create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/pom.xml create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2String.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReader.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObjectLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDO.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOBuilder.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ModelDataObject.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOContextHelper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDODataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOExceptionHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOHelperContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOSimpleTypeMapper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandler.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/databinding.sdo.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/extension.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2StringTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReaderTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObjectLoaderTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDODataBindingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOExceptionHandlerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOTransformerTestCaseBase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandlerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/META-INF/tuscany/databinding.sdo.scdl create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/ipo.xsd create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/model/sca-core.xsd create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/stock.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/wrapper.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/wrapper.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/.ruleset create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/NOTICE.txt create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/pom.xml create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/Node2XmlObject.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLBeansDataBinding.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLStreamReader2XmlObject.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2Node.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2XMLStreamReader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/databinding.xmlbeans.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/extension.composite create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/java/org/apache/tuscany/databinding/xmlbeans/XmlObjectTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/resources/ipo.xsd create mode 100755 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/resources/ipo.xsdconfig create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/databinding/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospector.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidFragmentException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLContributionException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLLocationException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/NotSupportedWSDLException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/UnresolveableResourceException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLContributionProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoader.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLocation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLServiceContract.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistry.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XSDContributionProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/extension.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/idl.wsdl.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLContributionProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XSDContributionProcessorTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/example.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/invalid-stockquote.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/ipo.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/stockquote.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test1.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test1.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test2.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/.ruleset create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyLogger.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/TransportMonitor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/resources/META-INF/sca/http.jetty.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/resources/META-INF/sca/service.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/test/java/org/apache/tuscany/service/jetty/JettyServiceImplTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/CancelTimerListener.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/StopTimerListener.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/Timer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/TimerListener.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/TimerManager.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/RemoteWorkItem.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/Work.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkCompletedException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkEvent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkItem.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkListener.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkManager.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkRejectedException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/CompositeContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ConversationEndedException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/CurrentCompositeContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/RequestContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceReference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceRuntimeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceUnavailableException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/Version.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Callback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/ComponentName.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Constructor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Context.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Conversation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/ConversationID.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Destroy.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/EagerInit.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/EndConversation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Init.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/OneWay.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Property.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Reference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Remotable.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Resource.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Scope.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Service.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-binding-sca.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-binding-webservice.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-core.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-implementation-java.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-interface-java.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-interface-wsdl.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/test/java/org/osoa/sca/annotations/CallbackTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/test/java/org/osoa/sca/annotations/usage/CallbackType.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CompositeContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Constants.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Conversation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ConversationEndedException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CurrentCompositeContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceRuntimeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceUnavailableException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Authentication.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Callback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ComponentName.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Confidentiality.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Constructor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Context.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationID.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Conversational.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Destroy.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EagerInit.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EndsConversation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Init.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Integrity.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Intent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/OneWay.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/PolicySets.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Property.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Qualifier.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Reference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Remotable.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Requires.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Scope.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Service.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/binding.axis2.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/databinding.axiom.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/databinding.sdo.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/interface.wsdl.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/test-extensions.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/java/org/apache/tuscany/test/interop/client/InteropTestDocLit.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/binding.axis2.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/databinding.axiom.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/databinding.sdo.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/interface.wsdl.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/test-extensions.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/wsdl/interoptestdoclit.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/java/interop/ClientTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/sca/test.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/binding.axis2.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/databinding.axiom.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/databinding.sdo.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/interface.wsdl.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/test-extensions.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/wsdl/sq.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/webapp/META-INF/sca/default.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/webapp/WEB-INF/web.xml create mode 100755 sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/t.bat create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/IntegrationTestHelp.html create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/resources/CallBackApiTest.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/resources/CallBackBasicTest.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/resources/CallBackCTypeClient.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/resources/CallBackIdClient.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/resources/CallBackSetCallbackTest.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/resources/CallBackSetCallbackConvTest.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/main/resources/META-INF/sca/application.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionDirectoryWatcherTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jar create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jar create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/resources/ConversationsTest.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/generate.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/pom.xml.vm create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/wsdl/Dummy.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Annotation.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Annotation.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Attribute.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Attribute.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Import.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Import.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Include.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Include.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Interop.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Notation.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Notation.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Person.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/datagraph.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/generate.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/greeterws.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/wsdl/Greeter.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/xsd/Person.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/test/java/org/apache/tuscany/sca/itest/JaxbDatabindingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/src/main/resources/greeter.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceClient.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/greetersdo.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/wsdl/Greeter.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/xsd/Person.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/test/java/org/apache/tuscany/sca/itest/SdoDatabindingTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/src/main/resources/generate/generate.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/.ruleset create mode 100755 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/NOTICE.txt create mode 100755 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/pom.xml create mode 100755 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/JAXBTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java create mode 100755 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/XmlObjectTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/Client.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/ClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/DataBindingBootStrapTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/Echo.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/EchoImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/DataBindingTest.composite create mode 100755 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xml create mode 100755 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xsd create mode 100755 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xsdconfig create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/ExceptionTest.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/intracomposite.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/xsd/StockExceptionTest.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/ExceptionTest.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/intracomposite.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/wsdl/StockExceptionTest.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/xsd/StockExceptionTest.xsd create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/resources/ExceptionTest.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/resources/intracomposite.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/LICENSE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/NOTICE.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/interceptor/MessageInterceptor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/interceptor/MessageInterceptorWirePostProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/resources/META-INF/sca/application.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/resources/org/apache/tuscany/sca/test/opoverload/interceptor/MessageInterceptor.scdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/fileProperty.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/CompositeTest.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myListService.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInComposite.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInRecursive.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleService.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive2.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalService.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInComposite.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursive.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myservice.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/SDOWSDLTest.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/WSDLTest.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component2bImpl.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component3bImpl.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component2bImpl.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component3bImpl.componentType create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3a4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3a4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3b4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3b4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3a4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3a4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3b4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3b4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3a4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3a4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3b4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3b4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3a4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3a4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3b4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3b4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3a4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3a4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3b4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3b4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3a4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3a4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3b4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3b4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3a4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3a4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3b4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3b4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3a4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3a4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3b4a.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3b4b.wsdl create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/pom.xml (limited to 'sca-java-1.x/branches') diff --git a/sca-java-1.x/branches/sca-java-integration/buildtools/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/buildtools/LICENSE.txt new file mode 100644 index 0000000000..0084319535 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/buildtools/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, serviceDefinition marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sca-java-1.x/branches/sca-java-integration/buildtools/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/buildtools/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/buildtools/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/buildtools/pom.xml b/sca-java-1.x/branches/sca-java-integration/buildtools/pom.xml new file mode 100644 index 0000000000..d2c523f7fe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/buildtools/pom.xml @@ -0,0 +1,58 @@ + + + + 4.0.0 + + org.apache.tuscany + parent + 0.1-integration-incubating-SNAPSHOT + + buildtools + jar + Apache Tuscany Build Tools + 0.1-integration-incubating-SNAPSHOT + Module containing build tools for Apache Tuscany. This contains things such as the configuration for checkstyle and PMD. + + + + + apache.snapshots + Apache Snapshot Repository + http://people.apache.org/repo/m2-snapshot-repository + + false + + + true + + + + apache.incubator + Apache Incubator Repository + http://people.apache.org/repo/m2-incubating-repository/ + + true + + + false + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/buildtools/src/main/resources/tuscany-checkstyle.xml b/sca-java-1.x/branches/sca-java-integration/buildtools/src/main/resources/tuscany-checkstyle.xml new file mode 100644 index 0000000000..f6da3309d7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/buildtools/src/main/resources/tuscany-checkstyle.xml @@ -0,0 +1,295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/buildtools/src/main/resources/tuscany-suppressions.xml b/sca-java-1.x/branches/sca-java-integration/buildtools/src/main/resources/tuscany-suppressions.xml new file mode 100644 index 0000000000..23b8b45690 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/buildtools/src/main/resources/tuscany-suppressions.xml @@ -0,0 +1,32 @@ + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/pom.xml b/sca-java-1.x/branches/sca-java-integration/pom.xml new file mode 100644 index 0000000000..f0df38bd5c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/pom.xml @@ -0,0 +1,81 @@ + + + + + 4.0.0 + org.apache.tuscany + tuscany-project + 0.1-integration-incubating-SNAPSHOT + pom + Apache Tuscany Project + http://incubator.apache.org/tuscany/ + + Tuscany is an open source project implementing a Service Component Architecture. + + + + install + + + + + + stable + + true + + + pom/parent + buildtools + spec + sca + testing/sca + samples/sca + + + + + integration + + pom/parent + buildtools + spec + sca + testing/sca + samples/sca + + + + + unstable + + pom/parent + buildtools + spec + sca + testing/sca + samples/sca + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/pom/parent/pom.xml b/sca-java-1.x/branches/sca-java-integration/pom/parent/pom.xml new file mode 100644 index 0000000000..58960cf03e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/pom/parent/pom.xml @@ -0,0 +1,199 @@ + + + + 4.0.0 + + org.apache + apache + 3 + + org.apache.tuscany + parent + pom + Apache Tuscany Project Parent + Parent POM defining settings that can be used across Tuscany + 0.1-integration-incubating-SNAPSHOT + + + 2.0.4 + + + + . + + + + scm:svn:http://svn.apache.org/repos/asf/incubator/tuscany/java + scm:svn:https://svn.apache.org/repos/asf/incubator/tuscany/java + http://svn.apache.org/viewvc/incubator/tuscany/java + + + + jira + http://issues.apache.org/jira/browse/TUSCANY + + + + + + apache.ws.m1.snapshots + Apache Web Services M1 Snapshot Repository + http://ws.zones.apache.org/repository + legacy + + true + + + + + + + + apache.snapshots + Apache SNAPSHOT Repository + http://people.apache.org/repo/m2-snapshot-repository + + true + + + + + + codehaus-snapshot + Codehaus Snapshot Repository + http://snapshots.repository.codehaus.org + + true + + + + + + apache.incubator + Apache Incubator Repository + http://people.apache.org/repo/m2-incubating-repository + + true + + + + + + + + apache.incubator + Apache Incubator Repository + scp://people.apache.org/www/people.apache.org/repo/m2-incubating-repository + + + apache.snapshots + Apache Snapshot Repository + scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository + + + + + + + src/main/resources + + + ${notice.dir} + META-INF + true + + LICENSE.txt + NOTICE.txt + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + 1.5 + 1.5 + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.3 + + + **/*TestCase.java + + brief + false + once + -ea + + + + + + + + + + + eclipse + + src/main/resources + + + + + sourcecheck + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + org.apache.maven.plugins + maven-pmd-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + true + -Xlint:unchecked,deprecation,fallthrough,finally + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/LICENSE.txt new file mode 100644 index 0000000000..517cda22ca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/LICENSE.txt @@ -0,0 +1,416 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +=============================================================================================================== + + +License for the Service Data Objects JavaDoc and Interface Definition files. + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + +=================================================================================================== + +Common Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and + b) in the case of each subsequent Contributor: + + i) changes to the Program, and + + ii) additions to the Program; + + where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + + b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + + c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + + d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + + a) it complies with the terms and conditions of this Agreement; and + + b) its license agreement: + + i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + + ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + + iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + + iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + + a) it must be made available under this Agreement; and + + b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/NOTICE.txt new file mode 100644 index 0000000000..e445fc9ae5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/NOTICE.txt @@ -0,0 +1,32 @@ +Apache Tuscany SCA for Java +Copyright 2006 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), +sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted +projects until a further review indicates that the infrastructure, communications, +and decision making process have stabilized in a manner consistent with other successful +ASF projects. While incubation status is not necessarily a reflection of the completeness +or stability of the code, it does indicate that the project has yet to be fully endorsed +by the ASF. + +Unless otherwise indicated, all distribution made available by the Apache Software Foundation +is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). +A copy of the AL is provided with this distribution as the LICENSE.txt file present in the +root directory, and is also available at http://www.apache.org/licenses/. + +The terms and conditions governing the distribution may refer to the AL or other license +agreements, notices or terms and conditions. Some of these other license agreements may +include (but are not limited to): + + . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) + . Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html) + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) + +It is your obligation to read and accept all such terms and conditions prior to use of the +distribution. If term or condition is provided, please contact the Apache Software Foundation +to determine what terms and conditions govern that particular distribution. diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/.pmd b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/.pmd new file mode 100644 index 0000000000..ffc4fe2bbb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/.pmd @@ -0,0 +1,20 @@ + + +true diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/.ruleset b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/.ruleset new file mode 100644 index 0000000000..ba9b5ce886 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/.ruleset @@ -0,0 +1,190 @@ + + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/LICENSE.txt new file mode 100644 index 0000000000..517cda22ca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/LICENSE.txt @@ -0,0 +1,416 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +=============================================================================================================== + + +License for the Service Data Objects JavaDoc and Interface Definition files. + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + +=================================================================================================== + +Common Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and + b) in the case of each subsequent Contributor: + + i) changes to the Program, and + + ii) additions to the Program; + + where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + + b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + + c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + + d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + + a) it complies with the terms and conditions of this Agreement; and + + b) its license agreement: + + i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + + ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + + iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + + iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + + a) it must be made available under this Agreement; and + + b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/NOTICE.txt new file mode 100644 index 0000000000..e445fc9ae5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/NOTICE.txt @@ -0,0 +1,32 @@ +Apache Tuscany SCA for Java +Copyright 2006 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), +sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted +projects until a further review indicates that the infrastructure, communications, +and decision making process have stabilized in a manner consistent with other successful +ASF projects. While incubation status is not necessarily a reflection of the completeness +or stability of the code, it does indicate that the project has yet to be fully endorsed +by the ASF. + +Unless otherwise indicated, all distribution made available by the Apache Software Foundation +is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). +A copy of the AL is provided with this distribution as the LICENSE.txt file present in the +root directory, and is also available at http://www.apache.org/licenses/. + +The terms and conditions governing the distribution may refer to the AL or other license +agreements, notices or terms and conditions. Some of these other license agreements may +include (but are not limited to): + + . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) + . Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html) + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) + +It is your obligation to read and accept all such terms and conditions prior to use of the +distribution. If term or condition is provided, please contact the Apache Software Foundation +to determine what terms and conditions govern that particular distribution. diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/pom.xml new file mode 100644 index 0000000000..b28bd5b5da --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/pom.xml @@ -0,0 +1,178 @@ + + + + + org.apache.tuscany.samples.bigbank + bigbank-scenario + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + sample-bigbank-account + war + Tuscany BigBank Account Module + BigBank Scenario - Account Management Module + + + + + org.apache.tuscany.sca.kernel + tuscany-api + ${scaKernelVersion} + compile + + + org.apache.tuscany.sca.runtime.webapp + webapp-api + ${scaKernelVersion} + runtime + + + + + stax + stax-api + 1.0.1 + compile + + + + org.codehaus.woodstox + wstx-asl + 3.2.0 + runtime + + + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + ${sdo.version} + compile + + + + + org.apache.tuscany.das + tuscany-das-rdb + ${dasVersion} + compile + + + javax.servlet + servlet-api + 2.5 + provided + + + org.apache.derby + derby + 10.1.2.1 + compile + + + junit + junit + 4.2 + test + + + + ${artifactId} + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + ${sdo.version} + + + + + ${basedir}/src/main/resources/wsdl + true + true + true + + + generate + + + + + + org.apache.tuscany.sca.extensions.axis2.plugins + tuscany-plugin-wsdl2java + ${scaKernelVersion} + + + + + + ${basedir}/src/main/resources/wsdl/stockquotes.webservicex.wsdl + + StockQuoteSoap + + + + ${basedir}/src/main/resources/wsdl/AccountService.wsdl + + + + + generate + + + + + + org.apache.tuscany.sca.runtime.webapp + tuscany-war-plugin + ${scaKernelVersion} + + + tuscany-war + + tuscany-war + + + + + + + false + + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${scaKernelVersion} + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + ${scaKernelVersion} + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java new file mode 100644 index 0000000000..74baa636f5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java @@ -0,0 +1,279 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.services.account; + +import java.rmi.RemoteException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import bigbank.account.services.accountdata.AccountDataService; +import bigbank.account.services.stockquote.StockQuote; +import bigbank.account.services.stockquote.StockQuoteService; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountService; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +@Service(interfaces = AccountService.class) +public class AccountServiceImpl implements AccountService { + + public static final String CHECKING_ACCOUNT_PREFIX = "134-43-394"; + + public static final String SAVINGS_ACCOUNT_PREFIX = "134-42-623"; + + public static final String ACCOUNT_TYPE_SAVINGS = "savings"; + + public static final String ACCOUNT_TYPE_CHECKINGS = "checkings"; + + public static final DateFormat tsformatXSDDateTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz"); + static { + AccountServiceImpl.tsformatXSDDateTime.setTimeZone(TimeZone.getTimeZone("UTC")); + } + + private float currencyConversion = 0.0f; + + private String currency = "USD"; + + @Property + public void setCurrency(final String currency) { + this.currency = currency; + } + + float getCurrencyConversion() { + if (currencyConversion == 0.0F) { + if ("USD".equals(currency)) { + currencyConversion = 1.0f; + } else if ("EURO".equals(currency)) { + currencyConversion = 0.8f; + } else { + try { + currencyConversion = Float.parseFloat(currency); + } catch (Exception e) { + currencyConversion = 1.0f; + } + + } + + } + return currencyConversion; + + } + + private AccountDataService accountDataService; + + @Reference + public void setAccountDataService(AccountDataService accountDataService) { + this.accountDataService = accountDataService; + } + + private StockQuoteService stockQuoteService; + + @Reference + public void setStockQuoteService(StockQuoteService stockQuoteService) { + this.stockQuoteService = stockQuoteService; + } + + public AccountServiceImpl() { + } + + @SuppressWarnings("unchecked") + public AccountReport getAccountReport(int customerID) throws RemoteException { + + try { + AccountReport accountReport = accountDataService.getAccountReport(customerID); + // convert to local currency. + List accounts = accountReport.getAccountSummaries(); + for (AccountSummary accountSummary : accounts) { + accountSummary.setBalance(fromUSDollarToCurrency(accountSummary.getBalance())); + + } + return updateStockInformation(accountReport); + } catch (Exception e) { + e.printStackTrace(); + if (e instanceof RemoteException) { + throw (RemoteException) e; + } else { + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + } + + private AccountReport updateStockInformation(AccountReport accountReport) throws RemoteException { + List stocks = accountReport.getStockSummaries(); + if (stocks.size() < 1) { + return accountReport; // nothing todo + } + HashSet owned = new HashSet(stocks.size()); + for (StockSummary stock : stocks) { + owned.add(stock.getSymbol()); + } + ArrayList ownedStr = new ArrayList(owned.size() * 5); + for (String s : owned) { + + ownedStr.add(s); + } + + Map stockInfo = stockQuoteService.getQuotes(ownedStr.toArray(new String[owned.size()])); + + for (StockSummary stock : stocks) { + String symbol = stock.getSymbol(); + StockQuote stockquote = stockInfo.get(symbol); + if (stockquote == null) { + stock.setCurrentPrice(Float.NaN); + stock.setCompany("*not found*"); + stock.setHighPrice(Float.NaN); + stock.setLowPrice(Float.NaN); + + } else { + stock.setCurrentPrice(fromUSDollarToCurrency(convertToFloat(stockquote.getStockQuote()))); + stock.setCompany(stockquote.getCompanyName()); + stock.setHighPrice(fromUSDollarToCurrency(convertToFloat(stockquote.getDayHighPrice()))); + stock.setLowPrice(fromUSDollarToCurrency(convertToFloat(stockquote.getDayLowPrice()))); + } + } + + return accountReport; + } + + float convertToFloat(final String s) { + + try { + return Float.parseFloat(s); + } catch (Exception e) { + return Float.NaN; + } + + } + + private float fromUSDollarToCurrency(float value) { + return value * getCurrencyConversion(); + + } + + private float toUSDollarfromCurrency(float value) { + + return value / getCurrencyConversion(); + } + + public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException { + + try { + return accountDataService.getCustomerProfile(logonID); + } catch (Exception e) { + e.printStackTrace(); + if (e instanceof RemoteException) { + throw (RemoteException) e; + } else { + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + } + + public float deposit(String account, float ammount) throws RemoteException { + try { + return accountDataService.deposit(account, toUSDollarfromCurrency(ammount)); + } catch (RemoteException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + public StockSummary purchaseStock(int id, StockSummary stock) throws RemoteException { + try { + String symbol = stock.getSymbol(); + Map stockInfo = stockQuoteService.getQuotes(new String[] { symbol }); + + StockQuote stockQuote = stockInfo.get(symbol); + stock.setPurchasePrice(Float.parseFloat(stockQuote.getStockQuote())); + String purchaseDate = tsformatXSDDateTime.format(new Date()); + if (purchaseDate.endsWith("UTC")) { + purchaseDate = purchaseDate.substring(0, purchaseDate.length() - 3) + "Z"; + } + stock.setPurchaseDate(purchaseDate); + + return accountDataService.purchaseStock(id, stock); + } catch (RemoteException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + public StockSummary sellStock(int purchaseLotNumber, int quantity) throws RemoteException { + try { + return accountDataService.sellStock(purchaseLotNumber, quantity); + } catch (RemoteException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + public float withdraw(String account, float ammount) throws RemoteException { + try { + return accountDataService.withdraw(account, toUSDollarfromCurrency(ammount)); + } catch (RemoteException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings) + throws RemoteException { + try { + return accountDataService.createAccount(customerProfile, createSavings, createCheckings); + } catch (RemoteException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + public AccountLog getAccountLog(final int customerID) throws RemoteException { + return accountDataService.getAccountLog(customerID); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java new file mode 100644 index 0000000000..884127cd9e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.services.accountdata; + +public interface AccountDataService { + + /** + * Auto generated method signatures + * + * @param param0* + * @param param1* + * @param param2 + */ + public com.bigbank.account.StockSummary purchaseStock(int param0, com.bigbank.account.StockSummary parm1) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param4 + */ + public com.bigbank.account.CustomerProfileData getCustomerProfile(java.lang.String param4) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param6* + * @param param7 + */ + public float deposit(java.lang.String param6, float param7) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param9* + * @param param10* + * @param param11 + */ + public com.bigbank.account.CustomerProfileData createAccount(com.bigbank.account.CustomerProfileData param9, boolean param10, boolean param11) + throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param13* + * @param param14 + */ + public com.bigbank.account.StockSummary sellStock(int param13, int param14) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param16* + * @param param17 + */ + public float withdraw(java.lang.String param16, float param17) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param19 + */ + public com.bigbank.account.AccountReport getAccountReport(int param19) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param0 + */ + public com.bigbank.account.AccountLog getAccountLog(int param0) throws java.rmi.RemoteException; + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java new file mode 100644 index 0000000000..c346a3221f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java @@ -0,0 +1,400 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.services.accountdata; + +import java.io.InputStream; +import java.rmi.RemoteException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.List; +import java.util.Properties; +import java.util.TimeZone; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.DAS; +import org.osoa.sca.annotations.Service; + +import bigbank.account.services.account.AccountServiceImpl; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; +import commonj.sdo.DataObject; + +@Service(CustomerIdService.class) +public class AccountDataServiceDASImpl implements CustomerIdService { // TODO fix this! + + static public String dbDirectory = null; + + public static final DateFormat tsformatXSDDateTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz"); + + public static final DateFormat sqlformatDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSz"); + + static { + tsformatXSDDateTime.setTimeZone(TimeZone.getTimeZone("UTC")); + + } + + public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException { + + try { + InputStream mapping = createConfigStream(); + Connection conn = getConnection(); + DAS das = DAS.FACTORY.createDAS(mapping, conn); + + Command select = das.createCommand("SELECT firstName, lastName, loginID, password, id FROM customers where loginID = ?"); + + select.setParameter(1, logonID); + + DataObject root = select.executeQuery(); + conn.close(); + + Collection customers = root.getList("CustomerProfileData"); + CustomerProfileData customerProfileData = (CustomerProfileData) customers.iterator().next(); + + return customerProfileData; + } catch (Exception e) { + + e.printStackTrace(); + RemoteException re = new RemoteException("Failed to get customer profile'" + logonID + "' ", e); + re.printStackTrace(); + throw re; + } + } + + protected static final String driver = "org.apache.derby.jdbc.EmbeddedDriver"; + + protected static final String protocol = "jdbc:derby:"; + + public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings) + throws RemoteException { + + try { + DAS das = DAS.FACTORY.createDAS(getConnection()); + Command insert = das.createCommand("insert into customers (firstName,lastName,address,email, loginID, password ) values ('" + + customerProfile.getFirstName() + "', '" + customerProfile.getLastName() + "', '" + customerProfile.getAddress() + "', '" + + customerProfile.getEmail() + "', '" + customerProfile.getLoginID() + "', '" + customerProfile.getPassword() + "')"); + + insert.execute(); + CustomerProfileData ret = getCustomerProfile(customerProfile.getLoginID()); + String cid = ret.getId() + ""; + if (createSavings) { + insert = das.createCommand("insert into accounts (id,accountNumber, accountType, balance ) values (" + cid + ", '" + + AccountServiceImpl.SAVINGS_ACCOUNT_PREFIX + cid + "', '" + AccountServiceImpl.ACCOUNT_TYPE_SAVINGS + "', " + 1.0F + ")"); + insert.execute(); + + } + if (createCheckings) { + insert = das.createCommand("insert into accounts (id,accountNumber, accountType, balance ) values (" + cid + ", '" + + AccountServiceImpl.CHECKING_ACCOUNT_PREFIX + cid + "', '" + AccountServiceImpl.ACCOUNT_TYPE_CHECKINGS + "', " + 1.0F + ")"); + insert.execute(); + + } + + return ret; + } catch (Exception e) { + if (e instanceof RemoteException) { + throw (RemoteException) e; + } + throw new RemoteException("createAccount " + e.getClass().getName() + "'. " + e.getMessage(), e); + } + } + + public CustomerProfileData createAccountNOTWORKING(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings) + throws RemoteException { + try { + DAS das = DAS.FACTORY.createDAS(createConfigStream(), getConnection()); + Command read = das.getCommand("all customers"); + + // select.setDataObjectModel(); + DataObject root = read.executeQuery(); + + // Create a new stockPurchase + DataObject customer = root.createDataObject("customerProfileData"); + + // THIS SEEMS TO BE THE ONLY WAY TO DO THIS .. NO WAY TO JUST ADD AN EXISTING CUSTOMER. + customer.set("firstName", customerProfile.getFirstName()); + customer.set("lastName", customerProfile.getLastName()); + customer.set("address", customerProfile.getAddress()); + customer.set("email", customerProfile.getEmail()); + customer.set("loginID", customerProfile.getLoginID()); + customer.set("password", customerProfile.getPassword()); + + das.applyChanges(root); + return getCustomerProfile(customerProfile.getLoginID()); + + } catch (Exception e) { + if (e instanceof RemoteException) { + throw (RemoteException) e; + } + throw new RemoteException("createAccount " + e.getClass().getName() + "'. " + e.getMessage(), e); + } + + } + + public AccountReport getAccountReport(final int customerID) throws RemoteException { + try { + final AccountFactory accountFactory = AccountFactory.INSTANCE; + final AccountReport accountReport = accountFactory.createAccountReport(); + InputStream mapping = createConfigStream(); + + Connection conn = getConnection(); + DAS das = DAS.FACTORY.createDAS(mapping, conn); + + Command select = das.createCommand("SELECT accountNumber, accountType, balance FROM accounts where id = ?"); + select.setParameter(1, customerID); + + DataObject root = select.executeQuery(); + accountReport.getAccountSummaries().addAll(root.getList("AccountSummary")); + + // Get Stocks + + select = das.createCommand("SELECT Symbol, quantity, purchasePrice, purchaseDate, purchaseLotNumber FROM stocks where id = ?"); + select.setParameter(1, customerID); + + // select.addConverter("STOCKS.PURCHASEDATE", DateConverter.class.getName()); + + root = select.executeQuery(); + accountReport.getStockSummaries().addAll(root.getList("StockSummary")); + + conn.close(); + + return accountReport; + } catch (Exception e) { + if (e instanceof RemoteException) { + throw (RemoteException) e; + } + throw new RemoteException("getAccountReport failed. customerID ('" + customerID + "')" + e.getClass().getName() + "'. " + e.getMessage(), + e); + } + } + + public float withdraw(String account, float ammount) throws RemoteException { + + return deposit(account, -ammount); + } + + public float deposit(String account, float ammount) throws RemoteException { + + try { + Connection conn = getConnection(); + DAS das = DAS.FACTORY.createDAS(createConfigStream(), conn); + + Command select = das.createCommand("SELECT accountNumber, balance FROM accounts where accountNumber = ?"); + select.setParameter(1, account); + + DataObject root = select.executeQuery(); + Collection accounts = root.getList("AccountSummary"); + AccountSummary accountData = (AccountSummary) accounts.iterator().next(); + float newbalance = accountData.getBalance() + ammount; + accountData.setBalance(newbalance); + // update department set companyid = ? where department.name = ? + + Command update = das.getCommand("update balance"); + update.setParameter(1, new Float(newbalance)); + update.setParameter(2, account); + update.execute(); + conn.close(); + return newbalance; + } catch (Exception e) { + throw new RemoteException(e.getClass().getName(), e); + } + + } + + public StockSummary sellStock(int purchaseLotNumber, int quantity) throws RemoteException { + try { + DAS das = DAS.FACTORY.createDAS(createConfigStream(), getConnection()); + + Command read = das.getCommand("stockbylotSelect"); + read.setParameter(1, purchaseLotNumber);// autoboxing :-) + DataObject root = read.executeQuery(); + List stocks = root.getList("StockSummary"); + if (null != stocks && !stocks.isEmpty()) { + StockSummary stock = (StockSummary) stocks.get(0); + int newQuatity = Math.max(stock.getQuantity() - quantity, 0); + if (newQuatity < 1) { + + Command delete = das.createCommand("DELETE FROM STOCKS WHERE PURCHASELOTNUMBER = ?"); + delete.setParameter(1, purchaseLotNumber); + delete.execute(); + + } else { + + Command update = das.getCommand("stockbylot"); + + update.setParameter(1, newQuatity); + update.setParameter(2, purchaseLotNumber); + update.execute(); + + stock.setQuantity(newQuatity); + } + return stock; + } + + return null; + } catch (Exception e) { + throw new RemoteException("sellStock", e); + } + } + + public StockSummary purchaseStock(int id, StockSummary stock) throws RemoteException { + + try { + DAS das = DAS.FACTORY.createDAS(getConnection()); + Command insert = das.createCommand("insert into stocks (id, symbol, quantity, purchasePrice, purchaseDate) values (?,?,?,?,?)"); + insert.setParameter(1, new Integer(id)); + insert.setParameter(2, stock.getSymbol()); + insert.setParameter(3, stock.getQuantity()); + insert.setParameter(4, stock.getPurchasePrice()); + insert.setParameter(5, DateConverter.INSTANCE.getColumnValue(stock.getPurchaseDate())); + + insert.execute(); + + return stock; + } catch (Exception e) { + if (e instanceof RemoteException) { + throw (RemoteException) e; + } + throw new RemoteException("purchaseStock " + e.getClass().getName() + "'. " + e.getMessage(), e); + } + } + + protected Connection getConnection() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { + Connection conn; + Class.forName(driver).newInstance(); + Properties props = new Properties(); + // props.put("user", "tuscany"); + // props.put("password", "tuscany"); + conn = DriverManager.getConnection(protocol + dbDirectory + ";create=true", props); + + conn.setAutoCommit(false); + return conn; + } + + protected InputStream createConfigStream() { + InputStream mapping = getClass().getClassLoader().getResourceAsStream("DasAccountConfiguration.xml"); + return mapping; + } + + public static class DateConverter implements Converter { + public final static DateConverter INSTANCE = new DateConverter(); + + public DateConverter() { // public empty constructor + } + + public Object getPropertyValue(Object columnData) { + + try { + + String ret = tsformatXSDDateTime.format(columnData); + if (ret.endsWith("UTC")) { + ret = ret.substring(0, ret.length() - 3) + "Z"; + } + return ret; + + } catch (Exception e) { + + e.printStackTrace(); + throw new IllegalArgumentException(e); + } + + } + + public Object getColumnValue(Object propertyData) { + + if (propertyData instanceof java.util.Date) { + // Need to convert back to local time for DB and remove timezone notation at the end.. + String ret = sqlformatDateTime.format(propertyData); + char lc = ret.charAt(ret.length() - 1); + while (!Character.isDigit(lc)) { + ret = ret.substring(0, ret.length() - 1); + lc = ret.charAt(ret.length() - 1); + } + return ret; + } else if (propertyData instanceof String) { + + try { + String time = (String) propertyData; + char last = time.charAt(time.length() - 1); + if (last == 'z' || last == 'Z') { + time = time.substring(0, time.length() - 1); + } + if (!time.endsWith("UTC")) { + time = time + "UTC"; + } + return getColumnValue(tsformatXSDDateTime.parse(time)); + } catch (ParseException e) { + throw new IllegalArgumentException("'" + propertyData + "' does not parse to date."); + } + } else { + throw new IllegalArgumentException(); + } + + } + + } + + public int getCustomerIdByPurchaseLotNumber(int purchaseLotNumber) throws RemoteException { + + return queryCustomerId("select id from stocks where purchaseLotNumber = " + purchaseLotNumber); + } + + public int getCustomerIdByAccount(String account) throws RemoteException { + + return queryCustomerId("select id from accounts where accountNumber = '" + account + "'"); + } + + private int queryCustomerId(String query) throws RemoteException { + + try { + Connection conn = getConnection(); + + Statement s = conn.createStatement(); + + ResultSet rs = s.executeQuery(query); + int id = -1; + if (rs.next()) { + id = rs.getInt("id"); + } + + conn.commit(); + + rs.close(); + s.close(); + conn.close(); + + return id; + + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass().getName(), e); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..5e08cf634f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.services.accountdata; + +import java.rmi.RemoteException; +import java.util.List; + +import org.osoa.sca.annotations.Service; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +@Service(AccountDataService.class) +public class AccountDataServiceImpl implements AccountDataService { + + public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException { + // TODO Auto-generated method stub + return null; + } + + public AccountReport getAccountReport(int customerID) { + final AccountFactory accountFactory = AccountFactory.INSTANCE; + AccountReport accountReport = accountFactory.createAccountReport(); + List accounts = accountReport.getAccountSummaries(); + + AccountSummary account = accountFactory.createAccountSummary(); + account.setAccountType("1111"); + account.setAccountNumber("22-22-22"); + account.setBalance(123.45F); + accounts.add(account); + + account = accountFactory.createAccountSummary(); + account.setAccountType("04-11-19"); + account.setAccountNumber("11-23"); + account.setBalance(543.21F); + accounts.add(account); + + List stocks = accountReport.getStockSummaries(); + StockSummary stock = accountFactory.createStockSummary(); + stock.setSymbol("IBM"); + stock.setPurchaseDate("1999-11-23"); + stock.setPurchaseLotNumber(101); + stock.setPurchasePrice(33.33F); + stock.setQuantity(10); + stocks.add(stock); + + stock = accountFactory.createStockSummary(); + stock.setSymbol("TUSK"); + stock.setPurchaseDate("2005-01-05"); + stock.setPurchaseLotNumber(102); + stock.setPurchasePrice(11.11F); + stock.setQuantity(4); + stocks.add(stock); + return accountReport; + } + + public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings) + throws RemoteException { + // TODO Auto-generated method stub + return null; + } + + public float deposit(String param6, float param7) throws RemoteException { + // TODO Auto-generated method stub + return 0; + } + + public StockSummary purchaseStock(int param0, StockSummary stock) throws RemoteException { + // TODO Auto-generated method stub + return null; + } + + public StockSummary sellStock(int param13, int param14) throws RemoteException { + // TODO Auto-generated method stub + return null; + } + + public float withdraw(String param16, float param17) throws RemoteException { + // TODO Auto-generated method stub + return 0; + } + + public AccountLog getAccountLog(final int customerID) throws RemoteException { + throw new RemoteException("This method should not be called"); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java new file mode 100644 index 0000000000..b355a09008 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.services.accountdata; + +import java.rmi.RemoteException; + +/** + * This interface allows access to a customer's id from the data service. + */ +public interface CustomerIdService { + + /* + * Return -1 if purchaseLotNumber not found + */ + public int getCustomerIdByPurchaseLotNumber(int purchaseLotNumber) throws RemoteException; + + /* + * Return -1 if account not found + */ + public int getCustomerIdByAccount(String account) throws RemoteException; + + // TODO (isilval) Fix this !!! + // Apparently, configuration can't deal with extends so I am adding the contents of AccountDataService here + + /** + * Auto generated method signatures + * + * @param param0* + * @param param1* + * @param param2 + */ + public com.bigbank.account.StockSummary purchaseStock(int param0, com.bigbank.account.StockSummary parm1) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param4 + */ + public com.bigbank.account.CustomerProfileData getCustomerProfile(java.lang.String param4) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param6* + * @param param7 + */ + public float deposit(java.lang.String param6, float param7) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param9* + * @param param10* + * @param param11 + */ + public com.bigbank.account.CustomerProfileData createAccount(com.bigbank.account.CustomerProfileData param9, boolean param10, boolean param11) + throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param13* + * @param param14 + */ + public com.bigbank.account.StockSummary sellStock(int param13, int param14) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param16* + * @param param17 + */ + public float withdraw(java.lang.String param16, float param17) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param19 + */ + public com.bigbank.account.AccountReport getAccountReport(int param19) throws java.rmi.RemoteException; + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java new file mode 100644 index 0000000000..1225c95f84 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java @@ -0,0 +1,465 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.services.accountdb; + +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.Date; +import java.util.Properties; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.DAS; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.sdo.util.SDOUtil; + +import bigbank.account.services.account.AccountServiceImpl; +import bigbank.account.services.accountdata.AccountDataServiceDASImpl; +import bigbank.account.services.accountlogger.AccountLoggerServiceImpl; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; +import commonj.sdo.DataObject; +import com.bigbank.account.purchaseStock; +import com.bigbank.account.withdraw; + +public class AccountDBInit extends HttpServlet { + + private static final long serialVersionUID = -4795999792460944805L; + + protected static final String driver = "org.apache.derby.jdbc.EmbeddedDriver"; + + protected static final String protocol = "jdbc:derby:"; + + protected String dbDirectory = null; + + protected String dasConfigFile = null; + + boolean deleteExisting = false; + + @Override + public void init() throws ServletException { + try { + + registerTypes(); + ServletConfig servletConfig = getServletConfig(); + ServletContext servletContext = servletConfig.getServletContext(); + dbDirectory = servletContext.getRealPath("WEB-INF/bigbankdb/accounts"); + dasConfigFile = servletContext.getRealPath("WEB-INF/classes/DasAccountConfiguration.xml"); + deleteExisting = false; + + createDB(dbDirectory); + + } catch (Exception e) { + + e.printStackTrace(); + log(e.toString(), e); + throw new ServletException(e); + } + } + + /* + * (non-Java-doc) + * + * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest arg0, HttpServletResponse arg1) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/html"); + + PrintWriter out = response.getWriter(); + + out.println(); + out.println("

BigBank database initialization servlet !

"); + out.println(); + } + + public AccountDBInit() { + } + + public AccountDBInit(String dbDirectory, String dasConfigFile, Boolean deleteExisting) { + this.dbDirectory = dbDirectory; + this.dasConfigFile = dasConfigFile; + this.deleteExisting = deleteExisting; + } + + private Connection createConnection() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { + return createConnection(dbDirectory); + } + + private static Connection createConnection(final String location) throws InstantiationException, IllegalAccessException, ClassNotFoundException, + SQLException { + Connection conn; + Class.forName(driver).newInstance(); + Properties props = new Properties(); + conn = DriverManager.getConnection(protocol + location + ";create=true", props); + + conn.setAutoCommit(false); + return conn; + } + + public static void createDB(final String location) throws Exception { + Connection conn = null; + AccountDataServiceDASImpl.dbDirectory = location; + AccountLoggerServiceImpl.dbDirectory = location; // TODO get rid of this (isilval) + Exception processessingException = null; + try { + conn = createConnection(location); + + creatTables(conn); + + int id = createCustomer(conn, "Test", "User", "304 Fox Trot ln, Apex, NC", "test@das.org", "test", "password"); + createAccount(conn, id, AccountServiceImpl.SAVINGS_ACCOUNT_PREFIX + id, AccountServiceImpl.ACCOUNT_TYPE_SAVINGS, 123.43F); + createAccount(conn, id, AccountServiceImpl.CHECKING_ACCOUNT_PREFIX + id, AccountServiceImpl.ACCOUNT_TYPE_CHECKINGS, 23.12F); + createStockPurchase(conn, id, "IBM", 33, 66.20F, "2005-11-23 13:22:02"); + createStockPurchase(conn, id, "DELL", 13, 12.74F, "2003-01-03 11:04:03"); + createStockPurchase(conn, id, "LU", 7, 2.74F, "2003-01-04 16:04:03"); + createStockPurchase(conn, id, "IBM", 22, 81.43F, "2004-02-03 13:04:33"); + + id = createCustomer(conn, "test2", "demo2", "Pleasant Plains Rd, ViewMount, CO", "test2@das.org", "test2", "password"); + createAccount(conn, id, AccountServiceImpl.SAVINGS_ACCOUNT_PREFIX + id, AccountServiceImpl.ACCOUNT_TYPE_SAVINGS, 924.40F); + createAccount(conn, id, AccountServiceImpl.CHECKING_ACCOUNT_PREFIX + id, AccountServiceImpl.ACCOUNT_TYPE_CHECKINGS, 33.26F); + createStockPurchase(conn, id, "FOO", 3, 6.20F, "2000-09-11 09:11:01"); + + conn.commit(); + + } catch (org.apache.derby.impl.jdbc.EmbedSQLException e) { + if (conn != null && !conn.isClosed()) { + conn.rollback(); + } + if (e.getErrorCode() == 20000 && "X0Y32".equalsIgnoreCase(e.getSQLState()) && -1 != e.getMessage().indexOf("already exists")) { + // this is ok the database is there. + + } else { + + e.printStackTrace(); + processessingException = e; + throw e; + } + } finally { + try { + if (null != conn && !conn.isClosed()) { + + conn.close(); + } + conn = null; + } catch (Exception e) { + e.printStackTrace(); + if (null != processessingException) { + throw e; + } + } + } + + } + + protected static void creatTables(Connection conn) throws Exception { + Statement s = conn.createStatement(); + + s + .execute("create table customers(firstName varchar(80) NOT NULL, lastName varchar(80), address varchar(180),email varchar(40),loginID varchar(80) NOT NULL UNIQUE, password varchar(80), id int NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY)"); + + s.execute("create table accounts(id int NOT NULL, accountNumber varchar(80) NOT NULL UNIQUE, accountType varchar(80), balance real )"); + + s + .execute("create table stocks(id int NOT NULL, Symbol varchar(8) NOT NULL, quantity int NOT NULL, purchasePrice real NOT NULL, purchaseDate TIMESTAMP, purchaseLotNumber int NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY )"); + + s + .execute("create table acctLog (logSeqNo int NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY, id int NOT NULL, accountNumber varchar(80) NOT NULL, actionType varchar(32) NOT NULL, amount real )"); + + s + .execute("create table stockLog (logSeqNo int NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY, id int NOT NULL, Symbol varchar(8) NOT NULL, quantity int NOT NULL, actionType varchar(32) NOT NULL, purchaseLotNumber int NOT NULL )"); + + s.close(); + } + + protected static int createCustomer(Connection conn, final String firstName, final String lastName, final String address, final String email, + final String logonID, final String password) throws SQLException, Exception { + Statement s = conn.createStatement(); + + s.execute("insert into customers (firstName,lastName,address,email, loginID, password ) " + "values ('" + firstName + "', '" + lastName + + "', '" + address + "', '" + email + "', '" + logonID + "', '" + password + "')"); + + ResultSet rs = s.executeQuery("SELECT loginID, id FROM customers where loginID='" + logonID + "'"); + if (!rs.next()) { + throw new Exception("Wrong number of rows"); + } + int id = rs.getInt(2); + s.close(); + + return id; + } + + protected static void createAccount(Connection conn, int customerID, final String accountNumber, final String accountType, final float balance) + throws SQLException, Exception { + Statement s = conn.createStatement(); + + s.execute("insert into accounts (id,accountNumber, accountType, balance ) " + "values (" + customerID + ", '" + accountNumber + "', '" + + accountType + "', " + balance + ")"); + + s.close(); + } + + protected InputStream createConfigStream() { + InputStream mapping = getClass().getClassLoader().getResourceAsStream("DasAccountConfiguration.xml"); + return mapping; + } + + protected static void createStockPurchase(Connection conn, int customerID, final String stockSymbol, final int quantity, + final float purchasePrice, String purchaseDate) throws SQLException, Exception { + Statement s = conn.createStatement(); + + s.execute("insert into stocks (id, symbol, quantity, purchasePrice, purchaseDate ) values (" + customerID + ", '" + stockSymbol + "', " + + quantity + ", " + purchasePrice + ", '" + purchaseDate + "')"); + + s.close(); + + } + + protected static void registerTypes() { + SDOUtil.registerStaticTypes(AccountFactory.class); + // TODO remove + SDOUtil.registerStaticTypes(ConfigFactory.class); + + } + + public void testWithdrawThroughDAS(withdraw wd) throws Exception { + + Connection conn = createConnection(); + DAS das = DAS.FACTORY.createDAS(createConfigStream(), conn); + Command select = das.getCommand("get account"); + + select.setParameter(1, wd.getAccountNumber()); + + DataObject root = select.executeQuery(); + + Collection accounts = root.getList("AccountSummary"); + AccountSummary account = (AccountSummary) accounts.iterator().next(); + float newbalance = account.getBalance() - wd.getAmount(); + account.setBalance(newbalance); + // update department set companyid = ? where department.name = ? + + Command update = das.getCommand("update balance"); + update.setParameter(1, new Float(newbalance)); + update.setParameter(2, wd.getAccountNumber()); + + update.execute(); + conn.close(); + } + + protected void testStrockPurchaseThroughDAS(purchaseStock sp) throws InstantiationException, IllegalAccessException, ClassNotFoundException, + SQLException { + + DAS das = DAS.FACTORY.createDAS(createConfigStream(), createConnection()); + Command read = das.getCommand("all stocks"); + + DataObject root = read.executeQuery(); + + // Create a new stockPurchase + DataObject stockPurchase = root.createDataObject("StockSummary"); + stockPurchase.set("id", new Integer(sp.getId())); + stockPurchase.set("symbol", sp.getStock().getSymbol()); + stockPurchase.set("quantity", new Integer(sp.getStock().getQuantity())); + stockPurchase.set("purchasePrice", new Float(11.00)); + // String type = stockPurchase.getType().getProperty("purchaseDate").getType().toString(); + stockPurchase.setDate("purchaseDate", new Date()); + + das.applyChanges(root); + } + + public CustomerProfileData testgetCustomerByLoginIDThroughDASRead(final String logonID) throws Exception { + InputStream mapping = createConfigStream(); + Connection conn = createConnection(); + DAS das = DAS.FACTORY.createDAS(mapping, conn); + Command select = das.createCommand("SELECT firstName, lastName, loginID, password, id FROM customers where loginID = ?"); + + select.setParameter(1, logonID); + + DataObject root = select.executeQuery(); + conn.close(); + + Collection customers = root.getList("CustomerProfileData"); + CustomerProfileData customerProfileData = (CustomerProfileData) customers.iterator().next(); + System.out.println(customerProfileData); + System.out.flush(); + return customerProfileData; + + } + + protected void readDBstdout(PrintStream stream) throws Exception { + Connection conn = null; + try { + conn = createConnection(dbDirectory); + Statement s = conn.createStatement(); + ResultSet rs = s.executeQuery("SELECT firstName, lastName, loginID, password, id FROM customers ORDER BY lastName"); + while (rs.next()) { + stream.print(rs.getString(1)); + stream.print(" "); + stream.print(rs.getString(2)); + stream.print(" "); + stream.print(rs.getString(3)); + stream.print(" "); + stream.print(rs.getString(4)); + stream.print(" "); + stream.print(rs.getString(5)); + stream.println(); + int id = rs.getInt(5); + Statement s1 = conn.createStatement(); + ResultSet rs1 = s1.executeQuery("SELECT accountNumber, accountType, balance FROM accounts where id=" + id); + stream.println("====Customers accounts"); + while (rs1.next()) { + stream.print("\t"); + stream.print(rs1.getString(1)); + stream.print(" "); + stream.print(rs1.getString(2)); + stream.print(" "); + stream.print(rs1.getString(3)); + stream.println(); + } + rs1.close(); + rs1 = s1.executeQuery("SELECT symbol, quantity, purchasePrice, purchaseDate, purchaseLotNumber FROM stocks where id=" + id); + stream.println("====Customers Stocks"); + while (rs1.next()) { + stream.print("\t"); + stream.print(rs1.getString(1)); + stream.print(" "); + stream.print(rs1.getString(2)); + stream.print(" "); + stream.print(rs1.getString(3)); + stream.print(" "); + stream.print(rs1.getString(4)); + stream.print(" "); + stream.print(rs1.getString(5)); + stream.println(); + } + s1.close(); + stream.println(); + + } + s.close(); + conn.commit(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (conn != null) { + conn.close(); + } + conn = null; + } + + } + + public static class MyDateConverter implements Converter { + + private static final DateFormat tsformat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + + public Object getPropertyValue(Object columnData) { + + try { + return tsformat.parse(columnData.toString()); + } catch (ParseException e) { + + e.printStackTrace(); + throw new IllegalArgumentException(e); + } + + } + + public Object getColumnValue(Object propertyData) { + + if (propertyData instanceof Date) { + return tsformat.format(propertyData); + } else { + throw new IllegalArgumentException(); + } + + } + + } + + /** + * @param args + */ + public static void main(String[] args) throws Exception { + registerTypes(); + String dbDirectory = null; // "c:/derbydbtest/foo"; + String dasConfigFile = null; + Boolean deleteExisting = false; + for (String x : args) { + if ("-d".equals(x)) { + deleteExisting = true; + } + if (x.startsWith("-db:")) { + dbDirectory = x.substring("-db:".length()); + } + if (x.startsWith("-config:")) { + dasConfigFile = x.substring("-config:".length()); + ; + } + + } + AccountDBInit accountDBInit = new AccountDBInit(dbDirectory, dasConfigFile, deleteExisting); + + createDB(dbDirectory); + + accountDBInit.readDBstdout(System.out); + + // Test withdrawl + withdraw wd = AccountFactory.INSTANCE.createwithdraw(); + wd.setAccountNumber("134-43-3942"); + wd.setAmount(1.00F); + accountDBInit.testWithdrawThroughDAS(wd); + + accountDBInit.readDBstdout(System.out); + + // test stock purchase. + purchaseStock sp = AccountFactory.INSTANCE.createpurchaseStock(); + StockSummary stock = AccountFactory.INSTANCE.createStockSummary(); + stock.setSymbol("GOOG"); + stock.setQuantity(10); + stock.setPurchasePrice(25.00F); + sp.setId(1); + sp.setStock(stock); + + accountDBInit.testStrockPurchaseThroughDAS(sp); + + accountDBInit.readDBstdout(System.out); + + System.out.flush(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerDataServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerDataServiceImpl.java new file mode 100644 index 0000000000..2360344cd1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerDataServiceImpl.java @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.services.accountlogger; + +import java.rmi.RemoteException; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import bigbank.account.services.accountdata.AccountDataService; +import bigbank.account.services.accountdata.CustomerIdService; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +/** + * This class implements the Account Data Logger service component. + */ +@Service(AccountDataService.class) +public class AccountLoggerDataServiceImpl implements AccountDataService { + + private CustomerIdService accountDataService; // TODO fix this! + + @Reference + public void setAccountDataService(CustomerIdService accountDataService) { + this.accountDataService = accountDataService; + } + + private AccountLoggerService accountLoggerService; + + @Reference + public void setAccountLoggerService(AccountLoggerService accountLoggerService) { + this.accountLoggerService = accountLoggerService; + } + + public StockSummary purchaseStock(int id, StockSummary stock) throws RemoteException { + accountLoggerService.logPurchaseStock(id, stock); + + return accountDataService.purchaseStock(id, stock); + } + + public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException { + + return accountDataService.getCustomerProfile(logonID); + } + + public float deposit(String account, float amount) throws RemoteException { + try { + if (!(accountDataService instanceof CustomerIdService)) { + throw new RemoteException("Can't use data service as customer id service"); + } + int id = accountDataService.getCustomerIdByAccount(account); + // int id = accountDataService.getCustomerIdByAccount(account); + accountLoggerService.logDeposit(id, account, amount); + + return accountDataService.deposit(account, amount); + } catch (RemoteException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createChecking) + throws RemoteException { + + return accountDataService.createAccount(customerProfile, createSavings, createChecking); + } + + public StockSummary sellStock(int purchaseLotNumber, int quantity) throws RemoteException { + try { + int id = accountDataService.getCustomerIdByPurchaseLotNumber(purchaseLotNumber); + StockSummary ss = accountDataService.sellStock(purchaseLotNumber, quantity); + if (ss != null) { + if (!(accountDataService instanceof CustomerIdService)) { + throw new RemoteException("Can't use data service as customer id service"); + } + accountLoggerService.logSellStock(id, ss, quantity); + } + return ss; + } catch (RemoteException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + public float withdraw(String account, float amount) throws RemoteException { + if (!(accountDataService instanceof CustomerIdService)) { + throw new RemoteException("Can't use data service as customer id service"); + } + int id = accountDataService.getCustomerIdByAccount(account); + // int id = accountDataService.getCustomerIdByAccount(account); + accountLoggerService.logWithdrawal(id, account, amount); + + return accountDataService.withdraw(account, amount); + } + + public AccountReport getAccountReport(final int customerID) throws RemoteException { + + return accountDataService.getAccountReport(customerID); + } + + public AccountLog getAccountLog(final int customerID) throws RemoteException { + return accountLoggerService.getAccountLog(customerID); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerService.java new file mode 100644 index 0000000000..b9b2821d38 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerService.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.services.accountlogger; + +import java.rmi.RemoteException; + +import org.osoa.sca.annotations.OneWay; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.StockSummary; + +/** + * This is the business interface of the Account Logger service component. + */ +public interface AccountLoggerService { + + @OneWay + public void logDeposit(int id, String account, float amount) throws RemoteException; + + @OneWay + public void logWithdrawal(int id, String account, float amount) throws RemoteException; + + @OneWay + public void logPurchaseStock(int id, StockSummary stock) throws RemoteException; + + @OneWay + public void logSellStock(int id, StockSummary stock, int quantity) throws RemoteException; + + public AccountLog getAccountLog(int id) throws RemoteException; + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerServiceImpl.java new file mode 100644 index 0000000000..8919aad311 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerServiceImpl.java @@ -0,0 +1,216 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.services.accountlogger; + +import java.io.InputStream; +import java.rmi.RemoteException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.Properties; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.DAS; +import org.osoa.sca.annotations.Service; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountLog; +import com.bigbank.account.StockSummary; +import commonj.sdo.DataObject; + +/** + * This class implements the Account Logger service component. + */ +@Service(AccountLoggerService.class) +public class AccountLoggerServiceImpl implements AccountLoggerService { + + public static final String ACCT_ACTION_TYPE_DEPOSIT = "deposit"; + + public static final String ACCT_ACTION_TYPE_WITHDRAW = "withdraw"; + + public static final String STOCK_ACTION_TYPE_PURCHASE = "purchase"; + + public static final String STOCK_ACTION_TYPE_SELL = "sell"; + + static public String dbDirectory = null; + + protected static final String driver = "org.apache.derby.jdbc.EmbeddedDriver"; + + protected static final String protocol = "jdbc:derby:"; + + public void logDeposit(int id, String account, float amount) throws RemoteException { + DAS das = DAS.FACTORY.createDAS(getConnection()); + Command insert = das.createCommand("insert into acctLog (id, accountNumber, actionType, amount) values (?,?,?,?)"); + insert.setParameter(1, new Integer(id)); + insert.setParameter(2, account); + insert.setParameter(3, ACCT_ACTION_TYPE_DEPOSIT); + insert.setParameter(4, new Float(amount)); + + insert.execute(); + /* + * performLog("insert into acctLog (id, accountNumber, actionType, amount) values (" + id + ", '" + account + "', '" + + * ACCT_ACTION_TYPE_DEPOSIT + "', " + amount + ")"); + */ + } + + public void logWithdrawal(int id, String account, float amount) throws RemoteException { + DAS das = DAS.FACTORY.createDAS(getConnection()); + Command insert = das.createCommand("insert into acctLog (id, accountNumber, actionType, amount) values (?,?,?,?)"); + insert.setParameter(1, new Integer(id)); + insert.setParameter(2, account); + insert.setParameter(3, ACCT_ACTION_TYPE_WITHDRAW); + insert.setParameter(4, new Float(amount)); + + insert.execute(); + /* + * performLog("insert into acctLog (id ,accountNumber, actionType, amount) values (" + id + ", '" + account + "', '" + + * ACCT_ACTION_TYPE_WITHDRAW + "', " + amount + ")"); + */ + } + + public void logPurchaseStock(int id, StockSummary stock) throws RemoteException { + DAS das = DAS.FACTORY.createDAS(getConnection()); + Command insert = das.createCommand("insert into stockLog (id, Symbol, quantity, actionType, purchaseLotNumber) values (?,?,?,?,?)"); + insert.setParameter(1, new Integer(id)); + insert.setParameter(2, stock.getSymbol()); + insert.setParameter(3, new Integer(stock.getQuantity())); + insert.setParameter(4, STOCK_ACTION_TYPE_PURCHASE); + insert.setParameter(5, new Integer(stock.getPurchaseLotNumber())); + + insert.execute(); + /* + * performLog("insert into stockLog (id, Symbol, quantity, actionType, purchaseLotNumber) values (" + id + ", '" + stock.getSymbol() + "', " + + * stock.getQuantity() + ", '" + STOCK_ACTION_TYPE_PURCHASE + ", " + stock.getPurchaseLotNumber() + ")"); + */ + } + + public void logSellStock(int id, StockSummary stock, int quantity) throws RemoteException { + + String symbol = ((stock.getSymbol() != null) ? stock.getSymbol() : "null"); + DAS das = DAS.FACTORY.createDAS(getConnection()); + Command insert = das.createCommand("insert into stockLog (id, Symbol, quantity, actionType, purchaseLotNumber) values (?,?,?,?,?)"); + insert.setParameter(1, new Integer(id)); + insert.setParameter(2, symbol); + insert.setParameter(3, new Integer(quantity)); + insert.setParameter(4, STOCK_ACTION_TYPE_SELL); + insert.setParameter(5, new Integer(stock.getPurchaseLotNumber())); + + insert.execute(); + /* + * performLog("insert into stockLog (id, Symbol, quantity, actionType, purchaseLotNumber) values (" + id + ", '" + stock.getSymbol() + "', " + + * quantity + ", '" + STOCK_ACTION_TYPE_SELL + ", " + stock.getPurchaseLotNumber() + ")"); + */ + } + + private void performLog(String toLog) throws RemoteException { + + try { + Connection conn = getConnection(); + + Statement s = conn.createStatement(); + + s.execute(toLog); + + conn.commit(); + + System.out.println("SN id acctNo action amount"); + ResultSet rs = s.executeQuery("select * from acctLog"); + while (rs.next()) { + System.out.println(rs.getInt("logSeqNo") + " " + rs.getInt("id") + " " + rs.getString("accountNumber") + " " + + rs.getString("actionType") + " " + rs.getFloat("amount")); + } + + conn.commit(); + + System.out.println("SN Symbol qty action plot#"); + rs = s.executeQuery("select * from stockLog"); + while (rs.next()) { + System.out.println(rs.getInt("logSeqNo") + " " + rs.getString("Symbol") + " " + rs.getInt("quantity") + " " + + rs.getString("actionType") + " " + rs.getInt("purchaseLotNumber")); + } + + conn.commit(); + + s.close(); + + conn.close(); + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass().getName(), e); + } + + System.out.println("Logged " + toLog); + } + + protected Connection getConnection() throws RemoteException { + try { + Connection conn; + Class.forName(driver).newInstance(); + Properties props = new Properties(); + // props.put("user", "tuscany"); + // props.put("password", "tuscany"); + conn = DriverManager.getConnection(protocol + dbDirectory + ";create=true", props); + + conn.setAutoCommit(false); + return conn; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass().getName(), e); + } + } + + public AccountLog getAccountLog(final int customerID) throws RemoteException { + + try { + final AccountFactory accountFactory = AccountFactory.INSTANCE; + final AccountLog accountLog = accountFactory.createAccountLog(); + InputStream mapping = createConfigStream(); + + Connection conn = getConnection(); + DAS das = DAS.FACTORY.createDAS(mapping, conn); + Command select = das.createCommand("SELECT logSeqNo, accountNumber, actionType, amount FROM acctLog where id = ?"); + + select.setParameter(1, customerID); + + DataObject root = select.executeQuery(); + accountLog.getAccountLogEntries().addAll(root.getList("AccountLogEntry")); + + select = das.createCommand("SELECT logSeqNo, Symbol, quantity, actionType, purchaseLotNumber FROM stockLog where id = ?"); + select.setParameter(1, customerID); + root = select.executeQuery(); + accountLog.getStockLogEntries().addAll(root.getList("StockLogEntry")); + + conn.close(); + + return accountLog; + } catch (Exception e) { + if (e instanceof RemoteException) { + throw (RemoteException) e; + } + throw new RemoteException("getAccountLog failed. customerID ('" + customerID + "')" + e.getClass().getName() + "'. " + e.getMessage(), e); + } + } + + protected InputStream createConfigStream() { + InputStream mapping = getClass().getClassLoader().getResourceAsStream("DasAccountConfiguration.xml"); + return mapping; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java new file mode 100644 index 0000000000..c7498f093d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java @@ -0,0 +1,228 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.services.stockquote; + +public class StockQuote { + + private String companyName; + + private String symbol; + + private String stockQuote; + + private String lastUpdated; + + private String change; + + private String openPrice; + + private String dayHighPrice; + + private String dayLowPrice; + + private String volume; + + private String marketCap; + + private String yearRange; + + private String exDividendDate; + + private String dividendYield; + + private String dividendPerShare; + + /** + * + * + * @generated + */ + protected StockQuote() { + super(); + } + + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(String newCompanyName) { + companyName = newCompanyName; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String newStockTicker) { + symbol = newStockTicker; + } + + public String getStockQuote() { + return stockQuote; + } + + public void setStockQuote(String newStockQuote) { + stockQuote = newStockQuote; + } + + public String getLastUpdated() { + return lastUpdated; + } + + public void setLastUpdated(String newLastUpdated) { + lastUpdated = newLastUpdated; + } + + public String getChange() { + return change; + } + + public void setChange(String newChange) { + change = newChange; + } + + public String getOpenPrice() { + return openPrice; + } + + public void setOpenPrice(String newOpenPrice) { + openPrice = newOpenPrice; + } + + public String getDayHighPrice() { + return dayHighPrice; + } + + public void setDayHighPrice(String newDayHighPrice) { + dayHighPrice = newDayHighPrice; + } + + public String getDayLowPrice() { + return dayLowPrice; + } + + public void setDayLowPrice(String newDayLowPrice) { + dayLowPrice = newDayLowPrice; + } + + public String getVolume() { + return volume; + } + + public void setVolume(String newVolume) { + volume = newVolume; + } + + public String getMarketCap() { + return marketCap; + } + + public void setMarketCap(String newMarketCap) { + marketCap = newMarketCap; + } + + public String getYearRange() { + return yearRange; + } + + public void setYearRange(String newYearRange) { + yearRange = newYearRange; + } + + public String getExDividendDate() { + return exDividendDate; + } + + public void setExDividendDate(String newExDividendDate) { + exDividendDate = newExDividendDate; + } + + public String getDividendYield() { + return dividendYield; + } + + public void setDividendYield(String newDividendYield) { + dividendYield = newDividendYield; + } + + public String getDividendPerShare() { + return dividendPerShare; + } + + public void setDividendPerShare(String newDividendPerShare) { + dividendPerShare = newDividendPerShare; + } + + @Override + public String toString() { + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (companyName: "); + result.append(companyName); + result.append(", symbol: "); + result.append(symbol); + result.append(", stockQuote: "); + result.append(stockQuote); + result.append(", lastUpdated: "); + result.append(lastUpdated); + result.append(", change: "); + result.append(change); + result.append(", openPrice: "); + result.append(openPrice); + result.append(", dayHighPrice: "); + result.append(dayHighPrice); + result.append(", dayLowPrice: "); + result.append(dayLowPrice); + result.append(", volume: "); + result.append(volume); + result.append(", marketCap: "); + result.append(marketCap); + result.append(", yearRange: "); + result.append(yearRange); + result.append(", exDividendDate: "); + result.append(exDividendDate); + result.append(", dividendYield: "); + result.append(dividendYield); + result.append(", dividendPerShare: "); + result.append(dividendPerShare); + result.append(')'); + return result.toString(); + } + + @Override + public StockQuote clone() { + StockQuote ret = new StockQuote(); + ret.companyName = companyName; + ret.symbol = symbol; + ret.stockQuote = stockQuote; + ret.lastUpdated = lastUpdated; + ret.change = change; + ret.openPrice = openPrice; + ret.dayHighPrice = dayHighPrice; + ret.dayLowPrice = dayLowPrice; + ret.volume = volume; + ret.marketCap = marketCap; + ret.yearRange = yearRange; + ret.exDividendDate = exDividendDate; + ret.dividendYield = dividendYield; + ret.dividendPerShare = dividendPerShare; + return ret; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..9d5c243f9a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.services.stockquote; + +import java.rmi.RemoteException; +import java.util.Map; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface StockQuoteService { + + public Map getQuotes(String[] symbols) throws RemoteException; + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java new file mode 100644 index 0000000000..b0c31d4d81 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.services.stockquote; + +import java.rmi.RemoteException; +import java.util.Hashtable; +import java.util.Map; +import java.util.Random; + +/* Mock StockQuoteService */ + +public class StockQuoteServiceImpl implements StockQuoteService { + + static Random rn = new Random(); + + static Hashtable stocks = new Hashtable(); + + public synchronized Map getQuotes(String[] symbols) throws RemoteException { + Map ret = new Hashtable(); + for (String sym : symbols) { + sym = sym.toUpperCase(); + if (!ret.containsKey(sym)) { + StockQuote sq = stocks.get(sym); + if (sq == null) { + sq = new StockQuote(); + stocks.put(sym, sq); + sq.setSymbol(sym); + sq.setCompanyName(sym + " INC"); + float val = rn.nextFloat() * 97.0F + 3.0F; + sq.setStockQuote(val + ""); + sq.setDayHighPrice(val + ""); + sq.setDayLowPrice(val + ""); + sq.setOpenPrice(val + ""); + } else { + float diff = (rn.nextFloat() * 2.0F) - 1; + float newval = new Float(sq.getStockQuote()) + diff; // auto boxing cool. + sq.setStockQuote(newval + ""); + float dh = Math.max(newval, new Float(sq.getDayHighPrice())); + sq.setDayHighPrice(dh + ""); + float dl = Math.min(newval, new Float(sq.getDayLowPrice())); + sq.setDayLowPrice(dl + ""); + + } + ret.put(sym, sq.clone()); + } + + } + + return ret; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java new file mode 100644 index 0000000000..053f9d7f16 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java @@ -0,0 +1,153 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.services.stockquote; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.lang.reflect.Method; +import java.rmi.RemoteException; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Map; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamReader; + +import net.x.webservice.StockQuoteSoap; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the Stock quote service component. + */ +@Service(StockQuoteService.class) +@Scope("COMPOSITE") +public class StockQuoteWebservicexServiceImpl implements StockQuoteService { + + @Reference + public StockQuoteSoap stockQuoteService = null; // Injected by the SCA container. + + /** + * @throws RemoteException + * @see bigbank.account.services.stockquote.StockQuoteService#getQuotes(String[]) + */ + public Map getQuotes(final String[] symbols) throws RemoteException { + try { + assert null != stockQuoteService : "stockQuoteService was not set by the SCA runtime!"; + StringBuilder sb = new StringBuilder(5 * symbols.length); + for (String sym : symbols) { + if (sb.length() != 0) { + sb.append(' '); + } + sb.append(sym); + } + String stockdata = stockQuoteService.GetQuote(sb.toString()); + + InputStream in = new ByteArrayInputStream(stockdata.getBytes()); + XMLInputFactory factory = XMLInputFactory.newInstance(); + XMLStreamReader parser = factory.createXMLStreamReader(in); + ArrayList listQuotes = new ArrayList(); + Hashtable listQuoteHT = new Hashtable(); + MapStock currentStock = null; + StringBuilder currentText = new StringBuilder(100); + for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) { + String lname; + switch (event) { + case XMLStreamConstants.START_ELEMENT: + if (parser.getLocalName() == "Stock") { + + currentStock = new MapStock(); + listQuotes.add(currentStock); + } + break; + case XMLStreamConstants.END_ELEMENT: + lname = parser.getLocalName(); + String mname = "set" + lname; + try { + Method setter = MapStock.class.getMethod(mname, new Class[] { String.class }); + if (setter != null) { + setter.invoke(currentStock, currentText.toString()); + if (lname.equals("Symbol")) { + listQuoteHT.put(currentText.toString(), currentStock); + + } + } + } catch (NoSuchMethodException e) { + + } + // System.err.println(parser.getLocalName() + ":" + currentText.toString()); + currentText.setLength(0); + break; + case XMLStreamConstants.CHARACTERS: + // System.out.print(parser.getText()); + currentText.append(parser.getText()); + break; + case XMLStreamConstants.CDATA: + // System.out.print(parser.getText()); + currentText.append(parser.getText()); + break; + } // end switch + } // end while + parser.close(); + + return listQuoteHT; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass().getName() + e.getMessage(), e); + } + } + + public static class MapStock extends StockQuote { + + public void setLast(String val) { + super.setStockQuote(val); + } + + public void setDate(String val) { + }; + + public void setTime(String val) { + }; + + public void setHigh(String val) { + super.setDayHighPrice(val); + } + + public void setLow(String val) { + super.setDayLowPrice(val); + } + + public void setOpen(String val) { + super.setOpenPrice(val); + } + + public void setMktCap(String val) { + super.setMarketCap(val); + } + + public void setName(String val) { + super.setCompanyName(val); + } + + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/DasAccountConfiguration.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/DasAccountConfiguration.xml new file mode 100644 index 0000000000..ed1553eb40 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/DasAccountConfiguration.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + +
diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..bdec70a4fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,416 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +=============================================================================================================== + + +License for the Service Data Objects JavaDoc and Interface Definition files. + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + +=================================================================================================== + +Common Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and + b) in the case of each subsequent Contributor: + + i) changes to the Program, and + + ii) additions to the Program; + + where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + + b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + + c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + + d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + + a) it complies with the terms and conditions of this Agreement; and + + b) its license agreement: + + i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + + ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + + iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + + iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + + a) it must be made available under this Agreement; and + + b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/wsdl/AccountService.wsdl b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..9acb92664d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,467 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl new file mode 100644 index 0000000000..16c980a30e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl @@ -0,0 +1,136 @@ + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get Stock quote for a company Symbol + + + + + + + Get Stock quote for a company Symbol + + + + + + + Get Stock quote for a company Symbol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/webapp/WEB-INF/default.scdl b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/webapp/WEB-INF/default.scdl new file mode 100644 index 0000000000..7c83a1a648 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/webapp/WEB-INF/default.scdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + AccountServiceComponent + + + + USD + + + + + AccountLoggerDataServiceComponent + StockQuoteServiceComponent + + + + + AccountDataServiceComponent + AccountLoggerServiceComponent + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..509e5a052d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,70 @@ + + + + + + + Tuscany Bigbank Account sample + + + + + + + tuscany.online + false + + + + + org.apache.tuscany.runtime.webapp.TuscanyContextListener + + + + TuscanyServlet + Tuscany Servlet + org.apache.tuscany.runtime.webapp.TuscanyServlet + + + + TuscanyServlet + /* + + + + + AccountDBInit + bigbank.account.services.accountdb.AccountDBInit + 2 + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/test/java/bigbank/account/client/AccountClient.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/test/java/bigbank/account/client/AccountClient.java new file mode 100644 index 0000000000..28f9e762f0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/test/java/bigbank/account/client/AccountClient.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.client; + +import java.util.Iterator; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountService; +import com.bigbank.account.AccountSummary; + +public class AccountClient { + + public void start() { + } + + public void stop() { + } + + public static void main(String[] args) throws Exception { + + CompositeContext context = CurrentCompositeContext.getContext(); + + AccountService accountService = context.locateService(AccountService.class, "AccountServiceComponent"); + + AccountReport accountReport = accountService.getAccountReport(12345); + + for (Iterator i = accountReport.getAccountSummaries().iterator(); i.hasNext();) { + AccountSummary accountSummary = (AccountSummary) i.next(); + + System.out.println(accountSummary.getAccountNumber()); + System.out.println(accountSummary.getAccountType()); + System.out.println(accountSummary.getBalance()); + } + + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/Show.Image.html b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/Show.Image.html new file mode 100644 index 0000000000..9b18679abf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/Show.Image.html @@ -0,0 +1,40 @@ + + + + + + +
+ +
+ + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/accountfiles.png b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/accountfiles.png new file mode 100644 index 0000000000..9fc46488a0 Binary files /dev/null and b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/accountfiles.png differ diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/accountmodule.png b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/accountmodule.png new file mode 100644 index 0000000000..d4209a01e3 Binary files /dev/null and b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/accountmodule.png differ diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/modualoverview.png b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/modualoverview.png new file mode 100644 index 0000000000..7e6d7ba25e Binary files /dev/null and b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/modualoverview.png differ diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/webclientfiles.png b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/webclientfiles.png new file mode 100644 index 0000000000..b951ed2e5e Binary files /dev/null and b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/webclientfiles.png differ diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/webclientmodule.png b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/webclientmodule.png new file mode 100644 index 0000000000..dfd3a34bfb Binary files /dev/null and b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/webclientmodule.png differ diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/pom.xml new file mode 100644 index 0000000000..25eeef1ad9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/pom.xml @@ -0,0 +1,36 @@ + + + + + org.apache.tuscany.sampleapps + tuscany-sampleapps + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + org.apache.tuscany.samples.bigbank + bigbank-scenario + pom + Tuscany BigBank Scenario Sample + + + account + webclient + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/readme.html b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/readme.html new file mode 100644 index 0000000000..b5e90bb08f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/readme.html @@ -0,0 +1,894 @@ + + + + + + + + + Tuscany BigBank Sample Application + + + + + + +

Tuscany BigBank Sample Application

+ +

Overview

+ +

The Tuscany BigBank sample application  shows using + the Tuscany SCA runtime to build a  financial application. + There are two modules: webclient provides the front-end user + interface and account provides the back-end business services. + These are deployed as separate web applications

+ +

Location

+

This sample is located in the  + samples\applications\bigbank directory. There are two + subdirectories in that for the two modules account and webclient.

+ + +

Prerequisites

+ +

Obtain the following prerequisites and install according to + their documentation.

+ + + +

Building

+

This sample + can be built from the bigbank directory using Maven 2.0.4 with + the following command:

+

+  mvn
+

+ +

Setup

+

If you have enabled remote deployment in Tomcat by + adding the line:
+   <user username="admin" password="" + roles="manager"/>
+ into  <tomcat + dir>\conf\tomcat-users.xml  you can deploy the + WARs to Tomcat using the tomcat-maven-plugin:
+ mvn tomcat:deploy

+

Alternatively you can copy the WAR files to Tomcat's  + webapps directory.
+ + copy account\target\sample-bigbank-account.war <tomcat dir>\webapps
+ copy  + webclient\target\sample-bigbank-webclient.war <tomcat dir>\webapps
+

+ +

Running

+

Once you've started your web server, use your web + browser to view the following URL http://localhost:8080/sample-bigbank-webclient/
+ You can either use an already pre configured  account with + Login as test and + Password as password, or + you can  create a new account.
+ The demo is first configured to use a local mock stock quote + service that returns random stock data.  If you want to use + an actual stock quote provider follow these steps:

+ +
    +
  • Stop your server by issuing in the  <tomcat dir>\bin directory
  • + +
  • Issue shutdown + command to stop your web application server.
  • + +
  • Edit the account SCDL file <tomcat dir>\webapps\sample-bigbank-account\WEB-INF\default.scdl
  • + +
  • Change the SCDL wiring to remove the mock stock quote + service by commenting it out as follows:
    + <!--
    +     <component + name="StockQuoteServiceComponent">
    +         + <implementation.java + class="bigbank.account.services.stockquote.StockQuoteServiceImpl" + />
    +     </component>
    + -->
  • + +
  • Uncomment the real stockquote service section in lines 68 + to 80.
  • + +
  • Change to the directory  apache-tomcat-5.5.17\bin 
  • + +
  • issue startup +   command to start up the server in the + <tomcat dir>\bin + directory.
  • +
+

The sample should now be using the real stock quote + provider. 

+ +

Summary

This example illustrates using Tuscany runtime + in building a financial Web application using SCA programing + model.  The following key concepts are covered:

+ +
    +
  • Component implementations. that provide web + based  HTML user interface
  • + +
  • Component implementations that provide + local services in Java. Local services implement + internal application business logic such as tracking user state + and are not exposed remotely.
  • + +
  • Component implementations that have + configuration properties and service + references to other services
  • + +
  • Components that use and + configure the properties and + references of component implementations
  • + +
  • SCA Services to publish remotable services + via a Web Service binding.
  • + +
  • SCA References  to consume remotable + services via a Web Service binding
  • + +
  • Assembling implementation, components, entry points and + external service into composite components.
  • + +
  • Creating a module and all of its artifacts as part of a + web application to show a front-end access to SCA + services
  • + +
  • The use of Data Access services to persist and retrieve + Service Data Objects from Apache Derby.
  • + +
  • The use of  existing Web + services in  SCA.
  • +

BigBank sample provides the following user services: account + balance, making deposits and withdrawals  to purchase + and sell stock, and to view current stock value.
+ The sample is organized into two SCA modules: webclient and + account. The webclient module functionality is to provide user + information and obtain user input. The account module is used to + retrieve and store user information, account information, current + stock information and the purchasing and selling of stock. The + two modules interact via web services through SCA references and + services.

+
+ +
+ + + +
Webclient

+ + Webclient files
+ +

 

+ + + + + + + + + +
+ + + 
+ +
+ click to + enlarge +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Java + source files implementing SCA components and + interfaces.
+ AccountServiceComponentImpl.java Implements the account service.
AccountLoginServiceImpl.javaImplements the Login service.
LoginService.javaInterface for a services provided by a + login  service component.
ProfileService.javaInterface for a service provided by a profile + component.
ProfileServiceImpl.javaImplements the profile component.
SimpleLoginServiceImpl.javaA simple in memory login service.
+ Java + source files implementing Web HTML + interface.
AccountStatusTag.javaImplements a jsp tag that displays the + account information
StockStatusTag.javaImplements a jsp tag that displays the stock + information.
LoginBarrierTag.javaImplements a jsp tag that ensures the user is + logged in.
ServiceTag.javaPlaces an SCA service in the JSP page + context.
FormServlet.javaProcess user input and uses the + AccountService component.
LoginServlet.javaProcesses logging in and logout.
+ Files + that will be loaded as resources along + classpath.
AccountService.wsdlWSDL that  defines the account + service.
bigbank-tags.tldDefines the tag libs for the user + interface.
Files + located in WEB-INF directory.
default.scdlApplication's SCA SCDL file.
web.xmlApplication's web.xml file.
Generated + Files.
sdo sourceGenerated SDO. Created by tuscany-sdo-plugin + maven plugin.
wsdl2java-sourceGenerated SDO interface. Created by tuscany-plugin-wsdl2java + maven  plugin.
Build + files.
pom.xmlMaven build file.
+
+ +

 

+ +
Account

+ + Account module
+ +

 

+ + + + + + + + + +
+ + + 
+ +
+ click to + enlarge +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Java + source files implementing SCA components and + interfaces.
+ AccountServiceImpl.java Implements the account service + component.
AccountDataService.javaInterface defined for component implementing +  an account's data service.
AccountDataServiceDASImpl.javaA Data Access Service (DAS) implementation of + of the Account Data Service.
AccountDataServiceImpl.javaA Data Service implementation not using + DAS.
AccountDBInit.javaA utility to just create the database and it + table and fill in some initial data.
StockQuote.javaA class to hold the StockQuote + information.
StockQuoteService.javaInterface defined for a component + implementing a stock quote service.
StockQuoteServiceImpl.javaImplements a fake stock quote service.
StockQuoteWebservicexServiceImpl.javaImplements an actual stock quote + service.
+ Files + that will be loaded as resources along + classpath.
AccountService.wsdlWSDL that  defines the account + service
stockquotes.webservicex.wsdlActual stock quote service WSDL.
DasAccountConfiguration.xmlProvides any needed configuration info + including datasource properties, table + definitions,
Files + located in WEB-INF directory.
default.scdlApplication's SCA SCDL file.
web.xmlApplication's web.xml file.
Generated + Files.
sdo sourceGenerated SDO. Created by tuscany-sdo-plugin + maven plugin.
wsdl2java-sourceGenerated SDO interface. Created + by tuscany-plugin-wsdl2java + maven  plugin.
Build + files.
pom.xmlMaven build file.
+
+

+
+ + +
Pom.xml
+

The directions + for maven  how  to build the each module is located in + each module's directory in the pom.xml file.  The + application uses Java 1.5 and thus in the build  plugin + section needs the following compiler directives:

+             + <plugin>
+                 + <groupId>org.apache.maven.plugins</groupId>
+                 + <artifactId>maven-compiler-plugin</artifactId>
+                 + <configuration>
+                     + <source>1.5</source>
+ +                     + <target>1.5</target>
+ +                 + </configuration>
+             + </plugin>

+

Both webclient and account uses three maven + plugins: tuscany-sdo-plugintuscany-plugin-wsdl2java, + and tuscany-war-plugin. + The tuscany-sdo-plugin is provided by Tuscany 's SDO project + while the other two are provided by the Tuscany SCA project.

+

The tuscany-sdo-plugin +  references the WSDL's schema and generates all the files + located in target/sdo_source directory.  The application + uses these classes as a databinding instead of having to deal + directly with XML that  represents form as defined in the + WSDL's schema.

+

The tuscany-plugin-wsdl2java + plugin generates a Java interface in the target/wsdl2java-source + directory that is used to define the inteface (prottype) in the + wsdl.

+

The tuscany-war-plugin is + used to add both the Tuscany runtime and any Tuscany  + extensions required by the application in the war file.. Looking + at the pom.xml and search for  "tuscany-war-plugin" you'll find the + plugin.  Which extension you want loaded are specified in + the extensions section. The format + for this  closely follows Maven's artifact naming.  The + boolean loadExtensionDependencies + option if true will  resolve all dependencies for each + extension listed here and also include them in the war file. +  
+
+ +

Application

+ +
Web.xml

The web.xml + file in each module adds necessary "hooks" to initiate and + maintain the Tuscany SCA runtime in a web application host.
+  

+ + + + + + + + + + + + + + + + + + + + + +
+
+<listener>
+<listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+</listener>
+
+
This class initializes the Tuscany runtime when the + applications is started and helps finalize the Tuscany + runtime when the application has ended.
+
+<servlet>
+<servlet-name>TuscanyServlet</servlet-name>
+<display-name>Tuscany Servlet</display-name>
+<servlet-class>org.apache.tuscany.runtime.webapp.TuscanyServlet</servlet-class>
+</servlet>
+
+
This class provides the web applications servlet + interface to SCA components.  The Axis websevices + binding extension requires this.
+
+<listener>
+<listener-class>org.apache.tuscany.runtime.webapp.TuscanySessionListener</listener-class>
+</listener>
+
+
This listener helps provide SCA session support .

+

The web application can be run in offline or online when + resolving dependencies required by the application or it's + required extensions. This is configured in the web.xml with the + context-param element with a parameter name tuscany.online. If  not + specified or set to true, dependencies are resolved by searching + the local war repository, the local Maven repository, and remote + repositories. If specified and set to false, the remote + repositories will not be searched.

+ +
SCDL
+

Each module's SCA + application SCDL is located in the web application  + WEB-INF/default.scdl file.  This is the default location, + but within the web.xml it is possible to override this with a + context-param element  with the name tuscany.applicationScdlPath. +  The Tuscany System SCDL can also be overridden with another + context-param element with the name tuscany.systemScdlPath.
+ The SCDL  used by the BigBank application is defined by + SCA Assembly Model V0.96 , SCA Client and Implementation Model for Java + (V0.95)  and the SCA Web Service bindings specifications.
+ There is one extension to SCDL used by BigBank that is specific + to Tuscany that is used by SDO databinding extension. +  The import.sdo element in the SCDL + specifies which  SDO factories to register the SDO types. +  In the case of BigBank the factory is the class generated + by the tuscany-sdo-plugin maven plugin. An + example of this follows:

+
+ <dbsdo:import.sdo xmlns:dbsdo="http://incubator.apache.org/tuscany/xmlns/databinding/sdo/1.0-incubator-M2"
+factory="com.bigbank.account.AccountFactory"/> 
+
+
+ +
Code

The Java code for the most part just implements the + Web interface and the SCA components necessary to implement the + business logic. The code uses Java 5.0 annotations as documented + by the SCA Client and Implementation Model for Java + (V0.95) specifications. The samples uses one annotation that + is an Tuscany extension that is used by the databinding framework + to identify that the components expect to SDO s for complex data + types. An example of this is seen in the AccountService interface + which has the @DataType(name="commonj.sdo.DataObject") + annotation.

+ +

RDB DAS

+ +

The Relational Database DAS (RDB DAS) is used in this sample to access relational data in terms + of SDOs. All the code pertaining to this usage is contained to two one files: + AccountDataServiceDASImpl.java and DasAccountConfiguration.xml. The java file provides code that + instantiates and invokes the DAS and the XML file provides RDB DAS configuration.

+ +

The sample demonstrates a few of the RDB DAS capabilities including:

+ +
    + +
  • reading a graph of SDOs based on a select query provided inline
  • +
  • reading a graph of SDOs based on a named select query defined in the config file
  • +
  • executing a named command to manually insert data
  • +
  • leveraging SDO Change Summary to by utilizing the DAS "applyChanges" method to flush graph modifications
  • +
  • utilizing the DAS column-converter framework
  • +
  • using the column/property name mapping (aliasing)
  • + +
+ +

This sample does not currently demonstrate a few other key DAS features including Object relationships, optimistic + concurrency control, and the use of convention over configuration. User level documentation for the RDB DAS can + be found in the RDBDAS User's Guide. +

+

This sample uses the RDB DAS as a utility. A future version of this sample will access the DAS as an SCA service. +

+ + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/.pmd b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/.pmd new file mode 100644 index 0000000000..ffc4fe2bbb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/.pmd @@ -0,0 +1,20 @@ + + +true diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/.ruleset b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/.ruleset new file mode 100644 index 0000000000..ba9b5ce886 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/.ruleset @@ -0,0 +1,190 @@ + + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/LICENSE.txt new file mode 100644 index 0000000000..517cda22ca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/LICENSE.txt @@ -0,0 +1,416 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +=============================================================================================================== + + +License for the Service Data Objects JavaDoc and Interface Definition files. + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + +=================================================================================================== + +Common Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and + b) in the case of each subsequent Contributor: + + i) changes to the Program, and + + ii) additions to the Program; + + where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + + b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + + c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + + d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + + a) it complies with the terms and conditions of this Agreement; and + + b) its license agreement: + + i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + + ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + + iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + + iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + + a) it must be made available under this Agreement; and + + b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/NOTICE.txt new file mode 100644 index 0000000000..e445fc9ae5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/NOTICE.txt @@ -0,0 +1,32 @@ +Apache Tuscany SCA for Java +Copyright 2006 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), +sponsored by the Apache Web Services PMC. Incubation is required of all newly accepted +projects until a further review indicates that the infrastructure, communications, +and decision making process have stabilized in a manner consistent with other successful +ASF projects. While incubation status is not necessarily a reflection of the completeness +or stability of the code, it does indicate that the project has yet to be fully endorsed +by the ASF. + +Unless otherwise indicated, all distribution made available by the Apache Software Foundation +is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). +A copy of the AL is provided with this distribution as the LICENSE.txt file present in the +root directory, and is also available at http://www.apache.org/licenses/. + +The terms and conditions governing the distribution may refer to the AL or other license +agreements, notices or terms and conditions. Some of these other license agreements may +include (but are not limited to): + + . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) + . Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html) + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) + +It is your obligation to read and accept all such terms and conditions prior to use of the +distribution. If term or condition is provided, please contact the Apache Software Foundation +to determine what terms and conditions govern that particular distribution. diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/pom.xml new file mode 100644 index 0000000000..8336eb4240 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/pom.xml @@ -0,0 +1,167 @@ + + + + + org.apache.tuscany.samples.bigbank + bigbank-scenario + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + sample-bigbank-webclient + war + Tuscany BigBank Web Client Module + BigBank Scenario Sample - Web Front-End Module + + + + org.apache.tuscany.sca.kernel + tuscany-api + ${scaKernelVersion} + compile + + + + commonj + sdo-api-r2.1 + ${sdo.version} + compile + + + + stax + stax-api + 1.0.1 + runtime + + + org.codehaus.woodstox + wstx-asl + 3.2.0 + runtime + + + org.apache.tuscany.sdo + tuscany-sdo-impl + ${sdo.version} + compile + + + + org.apache.tuscany.sca.runtime.webapp + webapp-api + ${scaKernelVersion} + runtime + + + + + javax.servlet + servlet-api + 2.5 + provided + + + javax.servlet + jsp-api + 2.0 + provided + + + + junit + junit + 4.2 + test + + + + + ${artifactId} + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + ${sdo.version} + + + + ${basedir}/src/main/resources/wsdl/AccountService.wsdl + true + true + true + + + generate + + + + + + org.apache.tuscany.sca.extensions.axis2.plugins + tuscany-plugin-wsdl2java + ${scaKernelVersion} + + + + ${basedir}/src/main/resources/wsdl/AccountService.wsdl + + + generate + + + + + + org.apache.tuscany.sca.runtime.webapp + tuscany-war-plugin + ${scaKernelVersion} + + + tuscany-war + + tuscany-war + + + + + + + false + + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${scaKernelVersion} + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + ${scaKernelVersion} + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/account/AccountServiceComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/account/AccountServiceComponentImpl.java new file mode 100644 index 0000000000..a0f98f14f3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/account/AccountServiceComponentImpl.java @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.webclient.services.account; + +import java.rmi.RemoteException; + +import org.osoa.sca.ServiceUnavailableException; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountService; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +/** + */ +@Service(AccountService.class) +public class AccountServiceComponentImpl implements AccountService { + + private AccountService accountService; + + @Reference + public void setAccountService(AccountService accountService) { + this.accountService = accountService; + } + + /** + * + */ + public AccountServiceComponentImpl() { + super(); + } + + /** + * @see bigbank.account.services.account.AccountService#getAccountReport(java.lang.String) + */ + public AccountReport getAccountReport(int customerID) { + try { + return accountService.getAccountReport(customerID); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + + public StockSummary purchaseStock(int customerID, StockSummary stockSummary) throws RemoteException { + try { + return accountService.purchaseStock(customerID, stockSummary); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + + public CustomerProfileData getCustomerProfile(String param2) throws RemoteException { + try { + return accountService.getCustomerProfile(param2); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + + public float deposit(String account, float amount) throws RemoteException { + try { + return accountService.deposit(account, amount); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + + public StockSummary sellStock(int purchaseLotNumber, int quantity) throws RemoteException { + try { + return accountService.sellStock(purchaseLotNumber, quantity); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + + public float withdraw(String account, float amount) throws RemoteException { + try { + return accountService.withdraw(account, amount); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + + public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings) + throws RemoteException { + + return accountService.createAccount(customerProfile, createSavings, createCheckings); + } + + public AccountLog getAccountLog(int customerID) throws RemoteException { + try { + return accountService.getAccountLog(customerID); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/AccountLoginServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/AccountLoginServiceImpl.java new file mode 100644 index 0000000000..d6c40e8dda --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/AccountLoginServiceImpl.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.webclient.services.profile; + +import java.rmi.RemoteException; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import com.bigbank.account.AccountService; +import com.bigbank.account.CustomerProfileData; + +@Service(LoginService.class) +@Scope("COMPOSITE") +public class AccountLoginServiceImpl implements LoginService { + + public AccountService accountService; + + @Reference + public void setAccountService(AccountService accountService) { + this.accountService = accountService; + } + + public ProfileService profileService; + + @Reference + public void setProfileService(ProfileService profileService) { + this.profileService = profileService; + } + + public int login(String userName, String password) throws RemoteException { + + CustomerProfileData profileData = accountService.getCustomerProfile(userName); + + if (!password.equals(profileData.getPassword())) { + return INVALID_PASSWORD; + } + + profileService.setLoggedIn(true); + profileService.setFirstName(profileData.getFirstName()); + profileService.setLastName(profileData.getLastName()); + profileService.setId(profileData.getId()); + + return SUCCESS; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/LoginService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/LoginService.java new file mode 100644 index 0000000000..c688df2597 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/LoginService.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.webclient.services.profile; + +import java.rmi.RemoteException; + +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface LoginService { + + static final int SUCCESS = 1; + + static final int INVALID_LOGIN = -1; + + static final int INVALID_PASSWORD = -2; + + int login(String userName, String password) throws RemoteException; +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileService.java new file mode 100644 index 0000000000..551d80c935 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileService.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.webclient.services.profile; + +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface ProfileService { + + String getFirstName(); + + void setFirstName(String pName); + + String getLastName(); + + void setLastName(String pName); + + boolean isLoggedIn(); + + void setLoggedIn(boolean pStatus); + + int getId(); + + void setId(int pId); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileServiceImpl.java new file mode 100644 index 0000000000..5385a7c3fc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileServiceImpl.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.webclient.services.profile; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(ProfileService.class) +@Scope("SESSION") +public class ProfileServiceImpl implements ProfileService { + + private String firstName; + + public String getFirstName() { + return firstName; + } + + @Property + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + private String lastName; + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + private boolean loggedIn; + + public boolean isLoggedIn() { + return loggedIn; + } + + public void setLoggedIn(boolean status) { + loggedIn = status; + } + + private int id; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java new file mode 100644 index 0000000000..711c6ba0b9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.webclient.services.profile; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(LoginService.class) +public class SimpleLoginServiceImpl implements LoginService { + + public ProfileService profileService; + + @Reference + public void setProfileService(ProfileService profileService) { + this.profileService = profileService; + } + + public int login(String userName, String password) { + + if (!"test".equals(userName)) { + return INVALID_LOGIN; + } + + if (!"password".equals(password)) { + return INVALID_PASSWORD; + } + + profileService.setLoggedIn(true); + profileService.setFirstName("John"); + profileService.setLastName("Doe"); + profileService.setId(12345); + + return SUCCESS; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountLogTag.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountLogTag.java new file mode 100644 index 0000000000..08751bdc3d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountLogTag.java @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.webclient.tags.account; + +import java.util.Iterator; +import java.util.List; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +import bigbank.webclient.services.profile.ProfileService; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountService; + +public class AccountLogTag extends TagSupport { + + public AccountLogTag() { + super(); + } + + private String mAccountService; + + public String getAccountService() { + return mAccountService; + } + + public void setAccountService(String pAccountService) { + mAccountService = pAccountService; + } + + private String mProfileService; + + public String getProfileService() { + return mProfileService; + } + + public void setProfileService(String pProfileService) { + mProfileService = pProfileService; + } + + private String mId; + + @Override + public String getId() { + return mId; + } + + @Override + public void setId(String pId) { + mId = pId; + } + + private Iterator mIterator; + + @Override + public int doStartTag() throws JspException { + CompositeContext moduleContext = CurrentCompositeContext.getContext(); + + ProfileService profile = moduleContext.locateService(ProfileService.class, mProfileService); + + if (profile == null) { + throw new JspException("Profile [" + mProfileService + "] not found in current module context"); + } + + AccountService service = (AccountService) moduleContext.locateService(AccountService.class, mAccountService); + if (service == null) { + throw new JspException("Service [" + mAccountService + "] not found in current module context"); + } + List entries; + try { + AccountLog accountLog = service.getAccountLog(profile.getId()); + pageContext.setAttribute("StockLogEntries", accountLog.getStockLogEntries()); + entries = accountLog.getAccountLogEntries(); + } catch (Exception e) { + throw new JspException(e); + } + mIterator = entries.iterator(); + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_INCLUDE; + } else { + return SKIP_BODY; + } + } + + @Override + public int doAfterBody() { + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_AGAIN; + } else { + return SKIP_BODY; + } + } + + @Override + public void release() { + super.release(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountStatusTag.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountStatusTag.java new file mode 100644 index 0000000000..3733cc84dd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountStatusTag.java @@ -0,0 +1,135 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.webclient.tags.account; + +import java.util.Iterator; +import java.util.List; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +import bigbank.webclient.services.profile.ProfileService; + +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountService; + +/** + * Retrieves and iterates over account summary information for the current profile by accessing the remotable account service component + */ + +public class AccountStatusTag extends TagSupport { + + // ---------------------------------- + // Constructors + // ---------------------------------- + + public AccountStatusTag() { + super(); + } + + // ---------------------------------- + // Methods + // ---------------------------------- + + private String mAccountService; + + public String getAccountService() { + return mAccountService; + } + + public void setAccountService(String pAccountService) { + mAccountService = pAccountService; + } + + private String mProfileService; + + public String getProfileService() { + return mProfileService; + } + + public void setProfileService(String pProfileService) { + mProfileService = pProfileService; + } + + private String mId; + + @Override + public String getId() { + return mId; + } + + @Override + public void setId(String pId) { + mId = pId; + } + + private Iterator mIterator; + + @Override + public int doStartTag() throws JspException { + CompositeContext moduleContext = CurrentCompositeContext.getContext(); + + ProfileService profile = moduleContext.locateService(ProfileService.class, mProfileService); + + if (profile == null) { + throw new JspException("Profile [" + mProfileService + "] not found in current module context"); + } + + AccountService service = (AccountService) moduleContext.locateService(AccountService.class, mAccountService); + + if (service == null) { + throw new JspException("Service [" + mAccountService + "] not found in current module context"); + } + List summaries; + try { + AccountReport accountReport = service.getAccountReport(profile.getId()); + pageContext.setAttribute("StockSummaries", accountReport.getStockSummaries()); + summaries = accountReport.getAccountSummaries(); + } catch (Exception e) { + throw new JspException(e); + } + mIterator = summaries.iterator(); + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_INCLUDE; + } else { + return SKIP_BODY; + } + } + + @Override + public int doAfterBody() { + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_AGAIN; + } else { + return SKIP_BODY; + } + } + + @Override + public void release() { + super.release(); + mId = null; + mIterator = null; + } +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockLogTag.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockLogTag.java new file mode 100644 index 0000000000..ea2df8aa55 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockLogTag.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.webclient.tags.account; + +import java.util.Iterator; +import java.util.List; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +public class StockLogTag extends TagSupport { + + public StockLogTag() { + super(); + } + + private String mId; + + @Override + public String getId() { + return mId; + } + + @Override + public void setId(String pId) { + mId = pId; + } + + private Iterator mIterator; + + @Override + public int doStartTag() throws JspException { + + List entries = (List) pageContext.getAttribute("StockLogEntries"); + if (null == entries) { + return SKIP_BODY; + } + mIterator = entries.iterator(); + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_INCLUDE; + } else { + return SKIP_BODY; + } + } + + @Override + public int doAfterBody() { + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_AGAIN; + } else { + pageContext.setAttribute("StockLogEntries", null); + return SKIP_BODY; + } + } + + @Override + public void release() { + pageContext.setAttribute("StockLogEntries", null); + super.release(); + mId = null; + mIterator = null; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockStatusTag.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockStatusTag.java new file mode 100644 index 0000000000..b2c61193e7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockStatusTag.java @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.webclient.tags.account; + +import java.util.Iterator; +import java.util.List; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +/** + * Retrieves and iterates over account summary information for the current profile by accessing the remotable account service component + */ + +public class StockStatusTag extends TagSupport { + + public StockStatusTag() { + super(); + } + + private String mId; + + @Override + public String getId() { + return mId; + } + + @Override + public void setId(String pId) { + mId = pId; + } + + private Iterator mIterator; + + @Override + public int doStartTag() throws JspException { + + List summaries = (List) pageContext.getAttribute("StockSummaries"); + if (null == summaries) { + return SKIP_BODY; + } + mIterator = summaries.iterator(); + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_INCLUDE; + } else { + return SKIP_BODY; + } + } + + @Override + public int doAfterBody() { + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_AGAIN; + } else { + pageContext.setAttribute("StockSummaries", null); + return SKIP_BODY; + } + } + + @Override + public void release() { + pageContext.setAttribute("StockSummaries", null); + super.release(); + mId = null; + mIterator = null; + } +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/LoginBarrierTag.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/LoginBarrierTag.java new file mode 100644 index 0000000000..6c50595d0f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/LoginBarrierTag.java @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.webclient.tags.sca; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +import bigbank.webclient.services.profile.ProfileService; + +public class LoginBarrierTag extends TagSupport { + + public LoginBarrierTag() { + super(); + } + + private String mProfile; + + public String getProfile() { + return mProfile; + } + + public void setProfile(String pProfile) { + mProfile = pProfile; + } + + private String mUrl; + + public String getUrl() { + return mUrl; + } + + public void setUrl(String pUrl) { + mUrl = pUrl; + } + + int doPage = EVAL_PAGE; + + @Override + public int doStartTag() throws JspException { + if (mProfile == null || mProfile.length() < 1) { + throw new JspException("Invalid profile location specified"); + } + + CompositeContext moduleContext = CurrentCompositeContext.getContext(); + + ProfileService profile = moduleContext.locateService(ProfileService.class, mProfile); + + if (profile == null) { + throw new JspException("Profile [" + mProfile + "] not found in current module context"); + } + + if (profile.isLoggedIn()) { + return EVAL_BODY_INCLUDE; + } else { + try { + doPage = SKIP_PAGE; + pageContext.forward(mUrl); + ((HttpServletResponse) (pageContext.getResponse())).sendRedirect("login.html"); + return SKIP_BODY; + } catch (ServletException e) { + throw new JspException("Unable to forward to [" + mUrl + "]"); + } catch (IOException e) { + throw new JspException("Unable to forward to [" + mUrl + "]"); + } + } + } + + @Override + public int doEndTag() throws JspException { + return doPage; + } + + @Override + public void release() { + super.release(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/ServiceTag.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/ServiceTag.java new file mode 100644 index 0000000000..d1263377c2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/ServiceTag.java @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.webclient.tags.sca; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Places an SCA service in the JSP page context, making it available to other tags corresponding to its id value. + */ + +public class ServiceTag extends TagSupport { + + // ---------------------------------- + // Constructors + // ---------------------------------- + + public ServiceTag() { + super(); + } + + // ---------------------------------- + // Methods + // ---------------------------------- + + private String mName; + + /** + * Returns the name of the SCA service to import into the page context. + */ + public String getName() { + return mName; + } + + /** + * Sets name of the SCA service to import into the page context. + */ + public void setName(String pName) { + mName = pName; + } + + private String mId; + + /** + * Returns the id of the service in the page context + */ + @Override + public String getId() { + return mId; + } + + /** + * Sets the id of the service for the page context + */ + + @Override + public void setId(String pId) { + mId = pId; + } + + @Override + public int doStartTag() throws JspException { + CompositeContext moduleContext = CurrentCompositeContext.getContext(); + + Object service = moduleContext.locateService(Object.class, mName); + + if (service == null) { + throw new JspException("Service [" + mName + "] not found in current module context"); + } + if (mId == null) { + // if the Id name was not specified, default to the basic name of the + // service + mId = mName; + } + pageContext.setAttribute(mId, service); + return EVAL_BODY_INCLUDE; + } + + @Override + public int doEndTag() throws JspException { + return EVAL_PAGE; + } + + @Override + public void release() { + super.release(); + } +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/ui/FormServlet.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/ui/FormServlet.java new file mode 100644 index 0000000000..3acdbee845 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/ui/FormServlet.java @@ -0,0 +1,161 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.webclient.ui; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +import bigbank.webclient.services.profile.ProfileService; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountService; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +public class FormServlet extends HttpServlet { + + // private ServletContext mContext; + // public void init(ServletConfig pCfg) throws ServletException { + // mContext = pCfg.getServletContext(); + // } + + @Override + public void doPost(HttpServletRequest pReq, HttpServletResponse pResp) throws ServletException { + + try { + final String action = pReq.getParameter("action"); + + CompositeContext moduleContext = CurrentCompositeContext.getContext(); + AccountService accountServices = (AccountService) moduleContext.locateService(AccountService.class, "AccountServiceComponent"); + if (accountServices == null) { + throw new ServletException("AccountServiceComponent"); + } + ProfileService profileServices = null; + if (!"createAccount".equals(action)) { + profileServices = moduleContext.locateService(ProfileService.class, "ProfileServiceComponent"); + if (profileServices == null) { + throw new ServletException("ProfileServiceComponent not found."); + } + if (!profileServices.isLoggedIn()) { + throw new ServletException("User id '" + profileServices.getId() + "' not logged on."); + } + } + + if ("createAccount".equals(action)) { + createAccount(pReq, pResp, accountServices); + } else if ("account".equals(action)) { + accountTransaction(pReq, pResp, accountServices); + } else if ("stockPurchase".equals(action)) { + stockPurchase(pReq, pResp, profileServices, accountServices); + } else if ("stockSale".equals(action)) { + stockSale(pReq, pResp, profileServices, accountServices); + } else { + throw new IllegalArgumentException("Unknown action in Form servlet '" + action + "'."); + } + // mContext.getRequestDispatcher("summary.jsp").forward(pReq, pResp); + pResp.sendRedirect("summary.jsp"); + } catch (ServletException e) { + e.printStackTrace(); + throw e; + + } catch (Exception e) { + + throw new ServletException(e); + } + + } + + private void stockSale(HttpServletRequest req, HttpServletResponse resp, ProfileService profileServices, AccountService accountServices) + throws ServletException { + try { + if (!"cancel".equals(req.getParameter("cancel"))) { + + int quantity = Integer.parseInt(req.getParameter("quantity")); + int purchaseLotNumber = Integer.parseInt(req.getParameter("purchaseLotNumber")); + accountServices.sellStock(purchaseLotNumber, quantity); + } + + } catch (Exception e) { + + throw new ServletException("stockSale " + e.getMessage(), e); + } + + } + + private void stockPurchase(HttpServletRequest req, HttpServletResponse resp, ProfileService profileServices, AccountService accountServices) + throws ServletException { + try { + if (!"cancel".equals(req.getParameter("cancel"))) { + + String symbol = req.getParameter("symbol").trim().toUpperCase(); + int quantity = Integer.parseInt(req.getParameter("quantity")); + StockSummary stockSummry = AccountFactory.INSTANCE.createStockSummary(); + stockSummry.setSymbol(symbol); + stockSummry.setQuantity(quantity); + accountServices.purchaseStock(profileServices.getId(), stockSummry); + } + } catch (Exception e) { + throw new ServletException("stockPurchase " + e.getMessage(), e); + } + } + + private void accountTransaction(HttpServletRequest req, HttpServletResponse resp, AccountService accountServices) throws ServletException { + try { + if (!"cancel".equals(req.getParameter("cancel"))) { + String account = req.getParameter("account"); + String amount = req.getParameter("Amount"); + if ("deposit".equals(req.getParameter("actionType"))) { + accountServices.deposit(account, Float.parseFloat(amount)); + } else { + accountServices.withdraw(account, Float.parseFloat(amount)); + } + } + } catch (Exception e) { + throw new ServletException("accountTransaction " + e.getMessage(), e); + } + + } + + private void createAccount(HttpServletRequest pReq, HttpServletResponse pResp, AccountService accountServices) throws ServletException { + try { + CustomerProfileData customerProfileData = AccountFactory.INSTANCE.createCustomerProfileData(); + customerProfileData.setFirstName(pReq.getParameter("firstName")); + customerProfileData.setLastName(pReq.getParameter("lastName")); + customerProfileData.setAddress(pReq.getParameter("address")); + customerProfileData.setEmail(pReq.getParameter("email")); + customerProfileData.setLoginID(pReq.getParameter("loginID")); + customerProfileData.setPassword(pReq.getParameter("password")); + + CustomerProfileData resp = accountServices.createAccount(customerProfileData, "savings".equals(pReq.getParameter("savings")), "checkings" + .equals(pReq.getParameter("checkings"))); + LoginServlet.login(resp.getLoginID(), resp.getPassword()); + + } catch (IOException e) { + throw new ServletException(e); + } + + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/ui/LoginServlet.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/ui/LoginServlet.java new file mode 100644 index 0000000000..784cc4fb40 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/ui/LoginServlet.java @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.webclient.ui; + +import java.io.IOException; +import java.rmi.RemoteException; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +import bigbank.webclient.services.profile.LoginService; + +public class LoginServlet extends HttpServlet { + + @Override + public void init(ServletConfig pCfg) throws ServletException { + + } + + @Override + public void doPost(HttpServletRequest pReq, HttpServletResponse pResp) throws ServletException { + + if ("logout".equals(pReq.getParameter("logout")) || "logoutHIDDEN".equals(pReq.getParameter("logoutHIDDEN"))) { + HttpSession sess = pReq.getSession(); + if (sess != null) { + sess.invalidate(); + } + try { + pResp.sendRedirect("login.html"); + } catch (IOException e) { + + e.printStackTrace(); + throw new ServletException(e); + } + + } else { + pReq.getSession(); // make sure session started. + String login = pReq.getParameter("login"); + String password = pReq.getParameter("password"); + try { + int resp = login(login, password); + if (resp == LoginService.SUCCESS) { + + pResp.sendRedirect("summary.jsp"); + } else { + + pResp.sendRedirect("login.html"); + } + } catch (IOException e) { + throw new ServletException(e); + } + } + } + + static int login(final String login, final String password) throws ServletException { + + CompositeContext moduleContext = CurrentCompositeContext.getContext(); + LoginService loginMgr = moduleContext.locateService(LoginService.class, "LoginServiceComponent"); + + if (loginMgr == null) { + throw new ServletException("LoginManager not found"); + } + + try { + return loginMgr.login(login, password); + } catch (RemoteException e) { + + throw new ServletException(e); + } + + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..bdec70a4fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,416 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +=============================================================================================================== + + +License for the Service Data Objects JavaDoc and Interface Definition files. + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + +=================================================================================================== + +Common Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and + b) in the case of each subsequent Contributor: + + i) changes to the Program, and + + ii) additions to the Program; + + where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + + b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + + c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + + d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + + a) it complies with the terms and conditions of this Agreement; and + + b) its license agreement: + + i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + + ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + + iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + + iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + + a) it must be made available under this Agreement; and + + b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..124db9ac04 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,466 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/CustomerProfile.jsp b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/CustomerProfile.jsp new file mode 100644 index 0000000000..2dc17a8867 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/CustomerProfile.jsp @@ -0,0 +1,100 @@ + +<%-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --%> + + + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + +<%-- LINK href="theme/Master.css" rel="stylesheet" type="text/css" --%> +BigBank- Customer Account + +

Customer Account
+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
First name
Last name
Address
email
 
Checkings
Savings
 
Logon ID
Password
+
+   +
+


+

+ + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld new file mode 100644 index 0000000000..a3d92a2e46 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld @@ -0,0 +1,127 @@ + + + + 1.0 + 2.0 + BigBank Tags + Tag library containing BigBank tags + + service + bigbank.webclient.tags.sca.ServiceTag + JSP + Places a reference to an SCA Service in the page context + + id + true + false + + + name + true + false + + + + login + bigbank.webclient.tags.sca.LoginBarrierTag + JSP + Redirects if user is not logged in + + profile + true + false + + + url + true + false + + + + + accountStatus + bigbank.webclient.tags.account.AccountStatusTag + JSP + Accesses and iterates the account service + + id + true + false + + + accountService + true + false + + + profileService + true + false + + + + stockStatus + bigbank.webclient.tags.account.StockStatusTag + JSP + Accesses and iterates the stocks + + id + true + false + + + + + accountLog + bigbank.webclient.tags.account.AccountLogTag + JSP + Accesses and iterates the accounts log + + id + true + false + + + accountService + true + false + + + profileService + true + false + + + + stockLog + bigbank.webclient.tags.account.StockLogTag + JSP + Accesses and iterates the stocks log + + id + true + false + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/default.scdl b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/default.scdl new file mode 100644 index 0000000000..cf42086edb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/default.scdl @@ -0,0 +1,53 @@ + + + + + + + + + + + AccountServiceComponent + ProfileServiceComponent + + + Anonymous + + + + + + + + + AccountService + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..398767e345 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,83 @@ + + + + + + Tuscany Bigbank Web UI sample + + login.html + + + + TuscanyFilter + org.apache.tuscany.runtime.webapp.TuscanyFilter + + + TuscanyFilter + /* + + + + tuscany.online + false + + + + + org.apache.tuscany.runtime.webapp.TuscanyContextListener + + + + org.apache.tuscany.runtime.webapp.TuscanySessionListener + + + + org.apache.tuscany.runtime.webapp.TuscanyRequestListener + + + + LoginServlet + bigbank.webclient.ui.LoginServlet + 1 + + + FormServlet + bigbank.webclient.ui.FormServlet + 0 + + + + LoginServlet + /loginAction/* + + + FormServlet + /FormServlet/* + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/accountLog.jsp b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/accountLog.jsp new file mode 100644 index 0000000000..6e91a14dcc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/accountLog.jsp @@ -0,0 +1,99 @@ +<%-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --%> + + <%@ page import="com.bigbank.account.AccountLogEntry" %> + <%@ page import="com.bigbank.account.StockLogEntry" %> + <%@ page session="true" %> + <%@ page autoFlush="true" %> + <%@ taglib uri="/WEB-INF/bigbank-tags.tld" prefix="sca" %> + + + BigBank Account and Stock Log + + + + Account Log + + + + + + + + + + + + + + + + +
SeqAccountActionAmount
+ + + + + + + +
+ + + +
+ Stock Log + + + + + + + + <%-- spacer --%> + + + + + + + + + <%-- spacer --%> + + + + + + +
SeqSymbolQuantity  ActionPurchaseLotNumber
+ + + + + +    + + + +
+ + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/accountTransaction.jsp b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/accountTransaction.jsp new file mode 100644 index 0000000000..4017834867 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/accountTransaction.jsp @@ -0,0 +1,50 @@ + +<%-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --%> + + + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + +BigBank - <%=request.getParameter("account") %> + + +

Account <%= request.getParameter("account") %>
+
+
+

+
+ + + +Amount to <%=request.getParameter("transaction")%>
+
+
+
+      +
+ + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/login.html b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/login.html new file mode 100644 index 0000000000..a1a5440a4f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/login.html @@ -0,0 +1,60 @@ + + +Welcome to Big Bank + + + +
+ + + + +
Please login in to access your account
+ + + + + + + + + + + +   + +   + +
Login(test)
Password(password)
+
+


+
+
+
New to Big Bank? Please open a new account with us. +
+

+ + +

+ + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/purchaseStock.jsp b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/purchaseStock.jsp new file mode 100644 index 0000000000..90c3a813b6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/purchaseStock.jsp @@ -0,0 +1,59 @@ + +<%-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --%> + + + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + +BigBank- Stock purchase + +

Stock purchase
+
+

+
+ + + + + + + + + + + + + + + + + + + +
Symbol
Quantity
+
+   +
+


+

+ + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/stockSale.jsp b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/stockSale.jsp new file mode 100644 index 0000000000..a2b08f4352 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/stockSale.jsp @@ -0,0 +1,56 @@ + +<%-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --%> + + + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + +BigBank- Stock sale + +

Stock sale
+
+

+
+ + + + + + + + + + + + + + + + +
Quantity
+
+   +
+


+

+ + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/summary.jsp b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/summary.jsp new file mode 100644 index 0000000000..f31ded242f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/summary.jsp @@ -0,0 +1,144 @@ +<%-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --%> + + <%@ page import="com.bigbank.account.AccountSummary" %> + <%@ page import="com.bigbank.account.StockSummary" %> + <%@ page session="true" %> + <%@ page autoFlush="true" %> +<%@ taglib uri="/WEB-INF/bigbank-tags.tld" prefix="sca" %> + + + + + BigBank Account Summary + + + + Account Information for +
+ + + +    +
+ + + + + + + + + + + + + + + + + + + + + +
Account Balance
+ + + + + + + + + + +
+ + + +
+
+ Stocks:     
+
+ + + + + + + + <%-- spacer --%> + + + + + + <%-- spacer --%> + + + +
+
+ + + + <%-- spacer --%> + + + + + + + + <%-- spacer --%> + + + + +
SymbolQuantityPurchase Date  Purchase PriceCurrent PriceCompany NameToday HighToday Low   <%-- sell button --%>
+ + + + + +    + + + + + + + + + +    +
+ +
+ +
+
+ Account and Stock Logs:     
+
+ + + + +
diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/test/java/bigbank/webclient/client/TestAccountService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/test/java/bigbank/webclient/client/TestAccountService.java new file mode 100644 index 0000000000..d5ece151de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/test/java/bigbank/webclient/client/TestAccountService.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.webclient.client; + +import java.util.List; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + + +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountService; + +public class TestAccountService { + + + public static void main(String[] args) throws Exception { + CompositeContext moduleContext = CurrentCompositeContext.getContext(); + + AccountService accountService = (AccountService) moduleContext.locateService(AccountService.class, "AccountServiceComponent"); + + AccountReport report = accountService.getAccountReport(12345); + List summaries = report.getAccountSummaries(); + + System.out.println("retrieved " + summaries.size() + " summaries"); + + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/test/java/bigbank/webclient/client/TestLoginService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/test/java/bigbank/webclient/client/TestLoginService.java new file mode 100644 index 0000000000..9af80e99db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/test/java/bigbank/webclient/client/TestLoginService.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.webclient.client; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + + +import bigbank.webclient.services.profile.LoginService; + +public class TestLoginService { + + + + public static void main(String[] args) throws Exception { + + CompositeContext moduleContext = CurrentCompositeContext.getContext(); + LoginService loginService = moduleContext.locateService(LoginService.class, "LoginServiceComponent"); + + if (loginService.login("test", "password") == LoginService.SUCCESS) { + System.out.println("Success"); + } else { + System.out.println("Failure"); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/pom.xml new file mode 100644 index 0000000000..34eb1698b2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/pom.xml @@ -0,0 +1,70 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-sample-calculator + jar + Apache Tuscany Calculator Sample + A sample Calculator made of several SCA components wired together. + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + calculator.CalculatorClient + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/readme.html b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/readme.html new file mode 100644 index 0000000000..5d4e2cfcfb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/readme.html @@ -0,0 +1,103 @@ + + + + + + + + + Tuscany Simple Calculator Sample + + + + + +

Tuscany Simple Calculator Sample

+ +

Overview

+ +

This sample illustrates the use of SCA to wire components together inside a composite. +All connections between the components are local and are defined using Java interfaces.

+ +

Location

+ +

This sample is located  in the + samples\standalone\calculator directory. All the + following commands should be issued while working in the sample + directory.

+ +

Prerequisites

+ +

Obtain the following prerequisites and install according to + their documentation.

+ + + +

Building

+ +

To build the sample  issue :

+
+mvn
+
+ +

The result after executing is in the target subdirectory the sample-calculator.jar

+ +

Setup

+ +

Set up the Tuscany standalone runtime environment using the + following command:

+
+mvn dependency:unpack 
+
+ +

After completion there should be a target\distribution subdirectory + created that has the Tuscany standalone runtime.

+ +

Running

+ +

Execute the following command: (cut and paste to command line)

+
+java -jar target/distribution/bin/launcher.jar target/sample-calculator.jar
+
+ +

Results

+ +

The sample when run should simply display to the standard + output:
+ +
3 + 2=5.0 +
3 - 2=1.0 +
3 * 2=6.0 +
3 / 2=1.5 +
+

+ + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..4eeb30a9c2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/AddService.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..ea3e5341d5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.osoa.sca.annotations.EagerInit; +import org.osoa.sca.annotations.Scope; + +/** + * An implementation of the Add service + */ +@Scope("COMPOSITE") +@EagerInit +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + return n1 + n2; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..7ffaeac194 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the Calculator service and invoke it. + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + + SCARuntime.start("Calculator.composite"); + + CompositeContext context = CurrentCompositeContext.getContext(); + CalculatorService calculatorService = + context.locateService(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)); + + SCARuntime.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..031fa8b912 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..e9e3b7cef0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; + + +/** + * An implementation of the Calculator service. + */ +@Scope("COMPOSITE") +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/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..131c5a8014 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/DivideService.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..9c7e96a668 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.osoa.sca.annotations.Scope; + +/** + * An implementation of the Divide service. + */ +@Scope("COMPOSITE") +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + return n1 / n2; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..a917896aeb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..4892481203 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.osoa.sca.annotations.Scope; + +/** + * An implementation of the Multiply service. + */ +@Scope("COMPOSITE") +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + return n1 * n2; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..e328f024ea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/SubtractService.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..ee1d7c3457 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.osoa.sca.annotations.Scope; + +/** + * An implementation of the subtract service. + */ +@Scope("COMPOSITE") +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + return n1 - n2; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/Calculator.composite b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/Calculator.composite new file mode 100644 index 0000000000..dd69271a0f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/Calculator.composite @@ -0,0 +1,52 @@ + + + + + + + CalculatorServiceComponent + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/test/java/calculator/CalculatorTestCase.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/test/java/calculator/CalculatorTestCase.java new file mode 100644 index 0000000000..53a4b59acc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/test/java/calculator/CalculatorTestCase.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * This shows how to test the Calculator service component. + */ +public class CalculatorTestCase extends TestCase { + + private CalculatorService calculatorService; + + protected void setUp() throws Exception { + SCARuntime.start("Calculator.composite"); + + CompositeContext context = CurrentCompositeContext.getContext(); + calculatorService = context.locateService(CalculatorService.class, "CalculatorServiceComponent"); + } + + protected void tearDown() throws Exception { + SCARuntime.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/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/pom.xml new file mode 100644 index 0000000000..e828bd48f2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/pom.xml @@ -0,0 +1,79 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + tuscany-sample-composite-impl + jar + Apache Tuscany Composite Implementation Sample + A sample showing local wiring of a component implemented by a composite. + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + org.apache.maven.plugins + maven-jar-plugin + + + + composite.CompositeClient + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/CompositeClient.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/CompositeClient.java new file mode 100644 index 0000000000..7543b68a29 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/CompositeClient.java @@ -0,0 +1,26 @@ +package composite; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Simple client program that invokes the components that we wired together. + * + * @version $Rev$ $Date$ + */ +public class CompositeClient { + + public static void main(String[] args) throws Exception { + SCARuntime.start("OuterComposite.composite"); + + CompositeContext context = CurrentCompositeContext.getContext(); + + Source source = context.locateService(Source.class, "SourceComponent/InnerSourceService"); + System.out.println("Main thread " + Thread.currentThread()); + source.clientMethod("Client.main"); + Thread.sleep(500); + + SCARuntime.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/Source.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/Source.java new file mode 100644 index 0000000000..d0efcc1df1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/Source.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package composite; + +public interface Source { + + void clientMethod(String arg); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/SourceCallback.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/SourceCallback.java new file mode 100644 index 0000000000..baa95a8e39 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/SourceCallback.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package composite; + +public interface SourceCallback { + + void receiveResult(String result); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/SourceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/SourceImpl.java new file mode 100644 index 0000000000..b9a0c7ff74 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/SourceImpl.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package composite; + +import org.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/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/Target.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/Target.java new file mode 100644 index 0000000000..9a8f68a7fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/Target.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package composite; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.OneWay; + + +@Callback(SourceCallback.class) +public interface Target { + + @OneWay + void someMethod(String arg); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/TargetImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/TargetImpl.java new file mode 100644 index 0000000000..86686e9233 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/TargetImpl.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package composite; + +import org.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/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite.composite b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite.composite new file mode 100644 index 0000000000..fbb32febfb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite.composite @@ -0,0 +1,44 @@ + + + + + + + InnerSourceComponent + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite2.composite b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite2.composite new file mode 100644 index 0000000000..b4c64b39e3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite2.composite @@ -0,0 +1,33 @@ + + + + + + + InnerTargetComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/OuterComposite.composite b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/OuterComposite.composite new file mode 100644 index 0000000000..ad027b0de1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/OuterComposite.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/test/java/composite/CompositeTestCase.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/test/java/composite/CompositeTestCase.java new file mode 100644 index 0000000000..383150fef9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/test/java/composite/CompositeTestCase.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package composite; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +public class CompositeTestCase extends TestCase { + + private Source source; + + protected void setUp() throws Exception { + SCARuntime.start("OuterComposite.composite"); + + CompositeContext context = CurrentCompositeContext.getContext(); + source = context.locateService(Source.class, "SourceComponent/InnerSourceService"); + } + + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + + 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/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/.ruleset b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/.ruleset new file mode 100644 index 0000000000..a1547fea92 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/.ruleset @@ -0,0 +1,190 @@ + + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/pom.xml new file mode 100644 index 0000000000..e5bbb15a48 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/pom.xml @@ -0,0 +1,64 @@ + + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + + 4.0.0 + tuscany-sample-echo-binding + Apache Tuscany Echo Binding Sample + A Sample Binding Extension + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.kernel + tuscany-spi + 0.1-integration-incubating-SNAPSHOT + compile + + + + junit + junit + 4.2 + test + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java new file mode 100644 index 0000000000..dbab7cb4b5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import org.apache.tuscany.spi.model.BindingDefinition; + +/** + * @version $Rev$ $Date$ + */ +public class EchoBinding extends BindingDefinition { + public Object clone() { + return this; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBindingLoader.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBindingLoader.java new file mode 100644 index 0000000000..b01510bc74 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBindingLoader.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import static org.osoa.sca.Constants.SCA_NS; +import org.osoa.sca.annotations.Constructor; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.model.ModelObject; + +/** + * @version $Rev$ $Date$ + */ +public class EchoBindingLoader extends LoaderExtension { + + public static final QName BINDING_ECHO = new QName(SCA_NS, "binding.echo"); + + @Constructor + public EchoBindingLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + public QName getXMLType() { + return BINDING_ECHO; + } + + public EchoBinding load(CompositeComponent parent, + ModelObject object, + XMLStreamReader reader, + DeploymentContext context) throws XMLStreamException, LoaderException { + return new EchoBinding(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java new file mode 100644 index 0000000000..7cf1b35617 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import org.apache.tuscany.spi.builder.BuilderException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.ReferenceBinding; +import org.apache.tuscany.spi.component.ServiceBinding; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.BindingBuilderExtension; +import org.apache.tuscany.spi.model.AbstractReferenceDefinition; +import org.apache.tuscany.spi.model.ServiceDefinition; + +/** + * @version $Rev$ $Date$ + */ +public class EchoBuilder extends BindingBuilderExtension { + + public ServiceBinding build(CompositeComponent parent, + ServiceDefinition boundServiceDefinition, + EchoBinding bindingDefinition, + DeploymentContext deploymentContext) throws BuilderException { + return new EchoService(boundServiceDefinition.getName(), parent); + } + + public ReferenceBinding build(CompositeComponent parent, + AbstractReferenceDefinition boundReferenceDefinition, + EchoBinding bindingDefinition, + DeploymentContext deploymentContext) throws BuilderException { + return new EchoReference(boundReferenceDefinition.getName(), parent); + } + + protected Class getBindingType() { + return EchoBinding.class; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoInvoker.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoInvoker.java new file mode 100644 index 0000000000..83c3dd824d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoInvoker.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.TargetInvoker; + +/** + * @version $Rev$ $Date$ + */ +public class EchoInvoker implements TargetInvoker { + + private boolean cacheable; + + public boolean isCacheable() { + return cacheable; + } + + public void setCacheable(boolean cacheable) { + this.cacheable = cacheable; + } + + public boolean isOptimizable() { + return isCacheable(); + } + + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + // echo back the result, a real binding would invoke some API for flowing the request + return ((Object[])payload)[0]; + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object resp = invokeTarget(msg.getBody(), NONE); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBodyWithFault(e.getCause()); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoReference.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoReference.java new file mode 100644 index 0000000000..5d9f5329f5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoReference.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import javax.xml.namespace.QName; + +import static org.osoa.sca.Constants.SCA_NS; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ReferenceBindingExtension; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.TargetInvoker; + +/** + * @version $Rev$ $Date$ + */ +public class EchoReference extends ReferenceBindingExtension { + private static final QName BINDING_ECHO = new QName(SCA_NS, "binding.echo"); + + public EchoReference(String name, CompositeComponent parent) { + super(name, parent); + } + + public QName getBindingType() { + return BINDING_ECHO; + } + + public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) { + return new EchoInvoker(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoService.java new file mode 100644 index 0000000000..084777a632 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoService.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import javax.xml.namespace.QName; + +import static org.osoa.sca.Constants.SCA_NS; + +import org.apache.tuscany.spi.CoreRuntimeException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ServiceBindingExtension; + +/** + * @version $Rev$ $Date$ + */ +public class EchoService extends ServiceBindingExtension { + private static final QName BINDING_ECHO = new QName(SCA_NS, "binding.echo"); + + public EchoService(String name, CompositeComponent parent) throws CoreRuntimeException { + super(name, parent); + // do nothing, but this could register with the host environment + } + + + public QName getBindingType() { + return BINDING_ECHO; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/resources/META-INF/sca/extension.composite new file mode 100644 index 0000000000..12e295bee7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/resources/META-INF/sca/extension.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Client.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Client.java new file mode 100644 index 0000000000..46c4f760d0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Client.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +/** + * @version $Rev$ $Date$ + */ +public interface Client { + + void call(String msg); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/ClientImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/ClientImpl.java new file mode 100644 index 0000000000..f66d84cc4f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/ClientImpl.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import org.osoa.sca.annotations.Constructor; +import org.osoa.sca.annotations.Reference; + +/** + * @version $Rev$ $Date$ + */ +public class ClientImpl implements Client { + + private Echo echoReference; + + @Constructor + public ClientImpl(@Reference(name = "echoReference", required = true) Echo echoReference) { + this.echoReference = echoReference; + } + + public void call(String msg) { + String ret = echoReference.invoke(msg); + System.out.println("Returned message: "+ ret); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Echo.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Echo.java new file mode 100644 index 0000000000..045609853a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Echo.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +/** + * @version $Rev$ $Date$ + */ +public interface Echo { + + String invoke(String msg); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/EchoBindingTestCase.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/EchoBindingTestCase.java new file mode 100644 index 0000000000..8526924253 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/EchoBindingTestCase.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * @version $Rev$ $Date$ + */ +public class EchoBindingTestCase extends TestCase { + + private Client client; + + public void testEchoBinding() { + client.call("foo"); + } + + protected void setUp() throws Exception { + SCARuntime.start("EchoBinding.composite"); + CompositeContext context = CurrentCompositeContext.getContext(); + client = context.locateService(Client.class, "Client"); + } + + protected void tearDown() throws Exception { + SCARuntime.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite new file mode 100644 index 0000000000..b4e214869e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite @@ -0,0 +1,37 @@ + + + + + + + + Client + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/.ruleset b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/.ruleset new file mode 100644 index 0000000000..42a6f1be38 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/.ruleset @@ -0,0 +1,190 @@ + + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/pom.xml new file mode 100644 index 0000000000..9303a7d1b0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/pom.xml @@ -0,0 +1,104 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + tuscany-sample-echo-databinding + Apache Tuscany Echo DataBinding Sample + A DataBinding Sample + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-spi + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.ws.commons.axiom + axiom-api + SNAPSHOT + compile + + + + org.apache.ws.commons.axiom + axiom-impl + SNAPSHOT + runtime + + + + org.codehaus.woodstox + wstx-asl + 3.2.0 + runtime + + + + commons-logging + commons-logging + 1.1 + runtime + + + + junit + junit + 4.2 + test + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBinding.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBinding.java new file mode 100644 index 0000000000..da44906cf6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBinding.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import org.apache.tuscany.spi.model.BindingDefinition; + +/** + * @version $Rev$ $Date$ + */ +public class EchoBinding extends BindingDefinition { + + public Object clone() { + return this; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBindingLoader.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBindingLoader.java new file mode 100644 index 0000000000..b77dcca3b9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBindingLoader.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import static org.osoa.sca.Constants.SCA_NS; +import org.osoa.sca.annotations.Constructor; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.model.ModelObject; + +/** + * @version $Rev$ $Date$ + */ +public class EchoBindingLoader extends LoaderExtension { + + public static final QName BINDING_ECHO = new QName(SCA_NS, "binding.echo"); + + @Constructor + public EchoBindingLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + public QName getXMLType() { + return BINDING_ECHO; + } + + public EchoBinding load(CompositeComponent parent, + ModelObject object, + XMLStreamReader reader, + DeploymentContext context) throws XMLStreamException, LoaderException { + return new EchoBinding(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBuilder.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBuilder.java new file mode 100644 index 0000000000..7cf1b35617 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBuilder.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import org.apache.tuscany.spi.builder.BuilderException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.ReferenceBinding; +import org.apache.tuscany.spi.component.ServiceBinding; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.BindingBuilderExtension; +import org.apache.tuscany.spi.model.AbstractReferenceDefinition; +import org.apache.tuscany.spi.model.ServiceDefinition; + +/** + * @version $Rev$ $Date$ + */ +public class EchoBuilder extends BindingBuilderExtension { + + public ServiceBinding build(CompositeComponent parent, + ServiceDefinition boundServiceDefinition, + EchoBinding bindingDefinition, + DeploymentContext deploymentContext) throws BuilderException { + return new EchoService(boundServiceDefinition.getName(), parent); + } + + public ReferenceBinding build(CompositeComponent parent, + AbstractReferenceDefinition boundReferenceDefinition, + EchoBinding bindingDefinition, + DeploymentContext deploymentContext) throws BuilderException { + return new EchoReference(boundReferenceDefinition.getName(), parent); + } + + protected Class getBindingType() { + return EchoBinding.class; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoInvoker.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoInvoker.java new file mode 100644 index 0000000000..972dae843f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoInvoker.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.TargetInvoker; + +/** + * @version $Rev$ $Date$ + */ +public class EchoInvoker implements TargetInvoker { + + private boolean cacheable; + + public boolean isCacheable() { + return cacheable; + } + + public void setCacheable(boolean cacheable) { + this.cacheable = cacheable; + } + + public boolean isOptimizable() { + return isCacheable(); + } + + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + // echo back the result, a real binding would invoke some API for flowing the request + Object result = ((Object[]) payload)[0]; + System.out.println("Echo: " + result); + return result; + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object resp = invokeTarget(msg.getBody(), NONE); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBodyWithFault(e.getCause()); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoReference.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoReference.java new file mode 100644 index 0000000000..9eaf0914cc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoReference.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import static org.osoa.sca.Constants.SCA_NS; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ReferenceBindingExtension; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.TargetInvoker; + +/** + * @version $Rev$ $Date$ + */ +public class EchoReference extends ReferenceBindingExtension { + + private static final String OM_DATA_BINDING = OMElement.class.getName(); + + private static final QName BINDING_ECHO = new QName(SCA_NS, "binding.echo"); + + public EchoReference(String name, CompositeComponent parent) { + super(name, parent); + } + + public QName getBindingType() { + return BINDING_ECHO; + } + + @SuppressWarnings("unchecked") + public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) { + // HACK to set the databinding + operation.setDataBinding(OM_DATA_BINDING); + return new EchoInvoker(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoService.java new file mode 100644 index 0000000000..85ed497799 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoService.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import static org.osoa.sca.Constants.SCA_NS; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.CoreRuntimeException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ServiceBindingExtension; + +/** + * @version $Rev$ $Date$ + */ +public class EchoService extends ServiceBindingExtension { + private static final QName BINDING_ECHO = new QName(SCA_NS, "binding.echo"); + + public EchoService(String name, CompositeComponent parent) throws CoreRuntimeException { + super(name, parent); + // do nothing, but this could register with the host environment + } + + + public QName getBindingType() { + return BINDING_ECHO; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/resources/META-INF/sca/extension.composite new file mode 100644 index 0000000000..34a5bac134 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/resources/META-INF/sca/extension.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/ComponentAImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/ComponentAImpl.java new file mode 100644 index 0000000000..84466f90d0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/ComponentAImpl.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import org.apache.axiom.om.OMElement; +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; + + private String prefix; + + private String prefix1; + + private String bar; + + private OMElement omProperty; + + @Constructor + public ComponentAImpl(@Reference(name = "componentBReference", required = true) + Interface1 componentBReference) { + this.componentBReference = componentBReference; + } + + public Object call(Object 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 ret; + } + + public Object call1(Object 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 ret; + } + + @Property(name="prefix") + public void setPrefix(String prefix) { + System.out.println("[Property] prefix: " + prefix); + this.prefix = prefix; + } + + @Property(name="prefix1") + public void setPrefix1(String prefix1) { + System.out.println("[Property] prefix1: " + prefix1); + this.prefix1 = prefix1; + } + + /** + * @param bar the bar to set + */ + @Property(name="bar") + public void setBar(String bar) { + System.out.println("[Property] bar: " + bar); + this.bar = bar; + } + + /** + * @param omProperty the omProperty to set + */ + @Property(name="omProperty") + public void setOmProperty(OMElement omProperty) { + this.omProperty = omProperty; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/ComponentBImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/ComponentBImpl.java new file mode 100644 index 0000000000..f8783d39e9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/ComponentBImpl.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +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/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Echo.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Echo.java new file mode 100644 index 0000000000..f6d10d55c7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Echo.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Remotable; + +/** + * @version $Rev$ $Date$ + */ +// @DataType(name="org.apache.axiom.om.OMElement") +@DataType(name="org.w3c.dom.Node") +@Remotable +public interface Echo { + Object echo(Object msg); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/EchoDataBindingTestCase.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/EchoDataBindingTestCase.java new file mode 100644 index 0000000000..f15501a9a5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/EchoDataBindingTestCase.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * @version $Rev$ $Date$ + */ +public class EchoDataBindingTestCase extends TestCase { + + private Interface1 componentA; + + public void testTransform() { + componentA.call("123"); + componentA.call1("123"); + } + + protected void setUp() throws Exception { + SCARuntime.start("EchoDataBinding.composite"); + + CompositeContext context = CurrentCompositeContext.getContext(); + componentA = context.locateService(Interface1.class, "ComponentA"); + } + + protected void tearDown() throws Exception { + SCARuntime.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Interface1.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Interface1.java new file mode 100644 index 0000000000..bce5dd46cb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Interface1.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Remotable; + +/** + * @version $Rev$ $Date$ + */ +@DataType(name="java.lang.String") +@Remotable +public interface Interface1 { + Object call(Object msg); + Object call1(Object msg); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Interface2.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Interface2.java new file mode 100644 index 0000000000..c2f82971e9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Interface2.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Remotable; +import org.w3c.dom.Node; + +/** + * @version $Rev$ $Date$ + */ +@DataType(name="org.w3c.dom.Node") +@Remotable +public interface Interface2 { + Node call(Node msg); + @DataType(name="javax.xml.stream.XMLStreamReader") + XMLStreamReader call1(XMLStreamReader msg); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/EchoDataBinding.composite b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/EchoDataBinding.composite new file mode 100644 index 0000000000..e3407e4ab7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/EchoDataBinding.composite @@ -0,0 +1,61 @@ + + + + + + + + ComponentB + + + + + + ABC + + + XYZ + + + + + + + + + + + + + + + ABC + + + BAR + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/wsdl/echo.wsdl b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/wsdl/echo.wsdl new file mode 100644 index 0000000000..5749bd8aff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/wsdl/echo.wsdl @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/pom.xml new file mode 100644 index 0000000000..256bed66a2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/pom.xml @@ -0,0 +1,71 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + tuscany-sample-loanapplication + jar + Apache Tuscany Loan Application Conversation Sample + A sample implementation of a loan application conversation. + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + loanapplication.LoanApplicationClient + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanApplication.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanApplication.java new file mode 100644 index 0000000000..441f68ebf0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanApplication.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + +public class LoanApplication { + + private String customerName; + private float loanAmount; + + public LoanApplication(String customerName, float loanAmount) { + this.customerName = customerName; + this.loanAmount = loanAmount; + } + + public String toString() { + return "[Customer: " + customerName + ", loan amount: " + + loanAmount + "]"; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java new file mode 100644 index 0000000000..e4380e5e44 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +public class LoanApplicationClient { + + public static void main(String[] args) throws Exception { + SCARuntime.start("loanapplication.composite"); + + // Locate the MyClient component and invoke it + CompositeContext context = CurrentCompositeContext.getContext(); + + LoanClient loanClient = context.locateService(LoanClient.class, "LoanClientComponent"); + loanClient.applyForLoan("John Doe", 1000.0f); + System.out.println(loanClient.displayLoan()); + System.out.println("Loan approved: " + loanClient.isApproved()); + + SCARuntime.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanClient.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanClient.java new file mode 100644 index 0000000000..7e4438bbff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanClient.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + +public interface LoanClient { + + void applyForLoan(String customerName, float amount); + boolean isApproved(); + boolean isCancelled(); + String displayLoan(); + void cancelLoan(); + void closeLoan(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanClientImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanClientImpl.java new file mode 100644 index 0000000000..b06d9465a2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanClientImpl.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; + +@Scope("COMPOSITE") +public class LoanClientImpl implements LoanClient { + + private LoanService loanService; + + @Reference + public void setLoanService(LoanService loanService) { + this.loanService = loanService; + } + + public void applyForLoan(String customerName, float amount) { + loanService.apply(new LoanApplication(customerName, amount)); + } + + public boolean isApproved() { + if (loanService.getLoanStatus() == null) { + return false; + } + return loanService.getLoanStatus().equals("approved"); + } + + public boolean isCancelled() { + if (loanService.getLoanStatus() == null) { + return false; + } + return loanService.getLoanStatus().equals("cancelled"); + } + + public String displayLoan() { + return loanService.display(); + } + + public void cancelLoan() { + loanService.cancelApplication(); + } + + public void closeLoan() { + loanService.close(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanService.java new file mode 100644 index 0000000000..d09864ea55 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanService.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + +import org.osoa.sca.annotations.EndsConversation; +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Scope; + +@Scope("CONVERSATION") +@Remotable +public interface LoanService { + void apply(LoanApplication application); + void lockCurrentRate(int termInYears); + @OneWay + void cancelApplication(); + String getLoanStatus(); + String display(); + @EndsConversation + void close(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java new file mode 100644 index 0000000000..76a53323bd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + +import org.osoa.sca.annotations.AllowsPassByReference; +import org.osoa.sca.annotations.ConversationID; +import org.osoa.sca.annotations.Scope; + +@Scope("CONVERSATION") +@AllowsPassByReference +public class LoanServiceImpl implements LoanService { + + private LoanApplication application; + private String status; + private int termLocked = 0; + @ConversationID + protected String conversationID; + + public void apply(LoanApplication application) { + this.application = application; + status = "open"; + } + + public void lockCurrentRate(int termInYears) { + termLocked = termInYears; + status = "locked"; + } + + public void cancelApplication() { + status = "cancelled"; + } + + public String getLoanStatus() { + return status; + } + + public String display() { + return "Loan application: " + application + ", term: " + + termLocked + ", status: " + status + + ", conversationID: " + conversationID; + } + + public void close() { + this.application = null; + this.status = "closed"; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/resources/loanapplication.composite b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/resources/loanapplication.composite new file mode 100644 index 0000000000..d69f1e55d6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/resources/loanapplication.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java new file mode 100644 index 0000000000..c6f74e4445 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +public class LoanApplicationTestCase extends TestCase { + + private LoanClient loanClient; + + protected void setUp() throws Exception { + SCARuntime.start("loanapplication.composite"); + + CompositeContext context = CurrentCompositeContext.getContext(); + loanClient = context.locateService(LoanClient.class, "LoanClientComponent"); + } + + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + + public void test() throws Exception { + try { + loanClient.applyForLoan("John Doe", 1000.0f); + System.out.println("Applied: " + loanClient.displayLoan()); + System.out.println("Loan approved: " + loanClient.isApproved()); + loanClient.cancelLoan(); + System.out.println("Sleeping to let cancel complete ..."); + Thread.sleep(500); + if (!loanClient.isCancelled()) { + fail("Loan should be cancelled"); + } + System.out.println("Cancelled: " + loanClient.displayLoan()); + loanClient.closeLoan(); + + /* This is a mistake, after @EndsConversation, a new conversation is + * started automatically, so we should not get TargetNotFoundException. + * Keep this for the timeout case, where we should get the exception + try { + System.out.println("Trying to use the closed loan in the ended conversation ..."); + System.out.println("Closed: " + loanClient.displayLoan()); + fail("Target should not be found"); + } catch(TargetNotFoundException e) { + System.out.println("Target not found as expected"); + } + */ + + // Now check that a new conversation's loan is not cancelled + + if (loanClient.isCancelled()) { + fail("Loan should not be cancelled"); + } + } catch(Throwable e) { + e.printStackTrace(); + if (e instanceof Exception) { + throw (Exception)e; + } + if (e instanceof Error) { + throw (Error)e; + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/pom.xml new file mode 100644 index 0000000000..0451883b33 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/pom.xml @@ -0,0 +1,86 @@ + + + + + org.apache.tuscany + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.samples.sca + parent + pom + Apache Tuscany SCA Samples + + + + + apache.snapshots + Apache Snapshot Repository + http://people.apache.org/repo/m2-snapshot-repository + + false + + + true + + + + apache.incubator + Apache Incubator Repository + http://people.apache.org/repo/m2-incubating-repository/ + + true + + + false + + + + + + calculator + composite-impl + loanapplication + simple-bigbank + simple-callback + supplychain + echo-binding + echo-databinding + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + 1.5 + 1.5 + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/pom.xml new file mode 100644 index 0000000000..1dfa957ed9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/pom.xml @@ -0,0 +1,71 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + tuscany-sample-simple-bigbank + jar + Apache Tuscany Simplified BigBank Sample + Simplified Big Bank Sample + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + bigbank.BigBankClient + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountReport.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountReport.java new file mode 100644 index 0000000000..01cadd43d2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountReport.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account; + +import bigbank.accountdata.Account; + +import java.util.List; +import java.util.ArrayList; + +/** + * @version $$Rev$$ $$Date$$ + */ + +public class AccountReport { + private List summaries = new ArrayList(); + + public List getAccountSummaries() { return summaries; } + + protected void addAccount(Account a) { summaries.add(a.getSummary()); } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountService.java new file mode 100644 index 0000000000..a29c8e3609 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountService.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account; + +/** + * @version $$Rev$$ $$Date$$ + */ + +public interface AccountService { + public AccountReport getAccountReport(String customerID); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java new file mode 100644 index 0000000000..0de4d11581 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account; + +import org.osoa.sca.annotations.Service; +import org.osoa.sca.annotations.Reference; + +import java.util.List; + +import bigbank.accountdata.AccountDataService; +import bigbank.accountdata.CheckingAccount; + +/** + * @version $$Rev$$ $$Date$$ + */ + +@Service(AccountService.class) +public class AccountServiceImpl implements AccountService { + + @Reference + public AccountDataService accountDataService; + + public AccountReport getAccountReport(String s) { + AccountReport report = new AccountReport(); + + CheckingAccount ca = accountDataService.getCheckingAccount(s); + report.addAccount(ca); + + return report; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/Account.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/Account.java new file mode 100644 index 0000000000..069577e3b1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/Account.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.accountdata; + +/** + * @version $$Rev$$ $$Date$$ + */ + +public interface Account { + String getSummary(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java new file mode 100644 index 0000000000..5213d7e7a5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.accountdata; + +/** + * @version $$Rev$$ $$Date$$ + */ + +public interface AccountDataService { + public CheckingAccount getCheckingAccount(String customerID); + public SavingsAccount getSavingsAccount(String customerID); + public StockAccount getStockAccount(String customerID); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..05e8ce485f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.accountdata; + +import org.osoa.sca.annotations.Service; + +/** + * @version $$Rev$$ $$Date$$ + */ + +@Service(AccountDataService.class) +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/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java new file mode 100644 index 0000000000..4c87cda44c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.accountdata; + +/** + * @version $$Rev$$ $$Date$$ + */ + +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/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java new file mode 100644 index 0000000000..daaa19995d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.accountdata; + +/** + * @version $$Rev$$ $$Date$$ + */ + +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/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java new file mode 100644 index 0000000000..7690e190f7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.accountdata; + +/** + * @version $$Rev$$ $$Date$$ + */ + +public class StockAccount implements Account { + private String accountNumber; + private String symbol; + private int quantity; + + 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 String getSummary() { return "ID:" + accountNumber + ", symbol:" + symbol + ", quantity:" + quantity; } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/BigBank.composite b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/BigBank.composite new file mode 100644 index 0000000000..88636afe53 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/BigBank.composite @@ -0,0 +1,44 @@ + + + + + + + AccountServiceComponent + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java new file mode 100644 index 0000000000..dbed3f8806 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +import bigbank.account.AccountService; + +public class BigBankTestCase extends TestCase { + + AccountService accountService; + + protected void setUp() throws Exception { + SCARuntime.start("BigBank.composite"); + + CompositeContext context = CurrentCompositeContext.getContext(); + accountService = context.locateService(AccountService.class, "AccountServiceComponent"); + } + + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + + public void test() throws Exception { + System.out.println("Account summary: " + accountService.getAccountReport("Foo") ); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/pom.xml new file mode 100644 index 0000000000..e23f247366 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/pom.xml @@ -0,0 +1,71 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + tuscany-sample-simple-callback + jar + Apache Tuscany Simple Callback Sample + A sample implementation of a simple callback application. + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + simplecallback.SimpleCallbackClient + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyClient.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyClient.java new file mode 100644 index 0000000000..4cc00d6d0f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyClient.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +/** + * The client interface + */ +public interface MyClient { + + void aClientMethod(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyClientImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyClientImpl.java new file mode 100644 index 0000000000..a1b7a987bd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyClientImpl.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package 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; + + @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); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyService.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyService.java new file mode 100644 index 0000000000..e78ad6f68f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyService.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import org.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/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyServiceCallback.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyServiceCallback.java new file mode 100644 index 0000000000..b27eea44f5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyServiceCallback.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +/** + * The callback interface for {@link MyService}. + */ +public interface MyServiceCallback { + + void receiveResult(String result); +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyServiceImpl.java new file mode 100644 index 0000000000..fc5e31d14e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyServiceImpl.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import org.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/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java new file mode 100644 index 0000000000..8153d906e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Demonstrates resolving the client service and initiating the callback sequence + */ +public class SimpleCallbackClient { + + public static void main(String[] args) throws Exception { + SCARuntime.start("simplecallback.composite"); + + // Locate the MyClient component and invoke it + CompositeContext context = CurrentCompositeContext.getContext(); + MyClient myClient = context.locateService(MyClient.class, "MyClientComponent"); + System.out.println("Main thread " + Thread.currentThread()); + myClient.aClientMethod(); + Thread.sleep(500); + + SCARuntime.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/resources/simplecallback.composite b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/resources/simplecallback.composite new file mode 100644 index 0000000000..1bb67ecfda --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/resources/simplecallback.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java new file mode 100644 index 0000000000..ecd1c245f4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * A testcase that demonstrates resolving the client service and initiating the callback sequence + */ +public class SimpleCallbackTestCase extends TestCase { + + private MyClient myClient; + + protected void setUp() throws Exception { + SCARuntime.start("simplecallback.composite"); + + CompositeContext context = CurrentCompositeContext.getContext(); + myClient = context.locateService(MyClient.class, "MyClientComponent"); + } + + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + + public void test() throws Exception { + System.out.println("Main thread " + Thread.currentThread()); + myClient.aClientMethod(); + System.out.println("Sleeping ..."); + Thread.sleep(1000); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/pom.xml new file mode 100644 index 0000000000..fb9a6a4bca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/pom.xml @@ -0,0 +1,71 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + tuscany-sample-supplychain + jar + Apache Tuscany Supply Chain Sample + A sample implementation of an asynchronous supply chain application. + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + supplychain.SupplyChainClient + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/readme.htm b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/readme.htm new file mode 100644 index 0000000000..901df1a741 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/readme.htm @@ -0,0 +1,89 @@ + + + + Tuscany +Supply Chain + +

Tuscany +Supply Chain Sample

+

Overview

+

The Tuscany supply chain sample shows using the Tuscany SCA +runtime in a J2SE environment executing the SCA asynchronous API.

+

Location

This +sample is located  in the samples\sca\supplychain directory.
+

Setup

This sample depends on the Tuscany runtime +and the sample jar, sample-supplychain-incubating-M1.jar +, both of these must be available on the classpath to run the sample. +

Running

In the directory samples\sca\supplychain +use the JDK 1.5 java command to run the class supplychain.SupplyChainClient
Linux: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar:target/sample-supplychain-incubating-M1.jar supplychain.SupplyChainClient
+
Windows: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar;target/sample-supplychain-incubating-M1.jar supplychain.SupplyChainClient

Results

+

The sample when run should simply display to the standard +output:

May 16, 2006 +3:12:13 PM org.apache.tuscany.core.client.TuscanyRuntime$Monitor +moduleStarted
INFO: Started application module [supplychain]
Main +thread Thread[main,5,main]
Work thread Thread[Thread-1,5,main] +- Order, submitted, fulfilled, shipped

+

Code Overview

+The source files are physically organized as shown below: +
src
+---main
    ++---java
    +¦   +---supplychain
    +¦           +Customer.java
    +¦           +CustomerComponentImpl.java
    +¦           +Retailer.java
    +¦           +RetailerComponentImpl.java
    +¦           +Shipper.java
    +¦           +ShipperComponentImpl.java
    +¦           +SupplyChainClient.java
    +¦           +Warehouse.java
    +¦           +WarehouseComponentImpl.java
    +¦
    +---resources
            +logging.properties
            +sca.module
+
+ + + + + +
Customer.javaDefines the Java interface implemented by the Customer +component.
CustomerComponentImpl.javaImplements the SCA Customer component.
Retailer.javaDefines the Java interface implemented by the Retailer +component.
RetailerComponentImpl.javaImplements +the SCA RetailerComponent component.
Shipper.javaDefines +the Java interface implemented by the Shipper component
ShipperComponentImpl.javaImplements +the SCA ShipperComponent component.
SupplyChainClient.javaSupplyChainClient.java +loads SCA runtime
Warehouse.javaDefines +the Java interface implemented by the Warehouse component.
WarehouseComponentImpl.javaImplements +the SCA WarehouseComponent component.
logging.propertiesConfigures +Tuscany logging. Provides the output of this demo.
sca.moduleDefines +and assembles the SCA components

diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/run.bat b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/run.bat new file mode 100755 index 0000000000..f0dc934ada --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/run.bat @@ -0,0 +1,7 @@ +echo off +rem set java_debug_set=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=3720,server=y,suspend=y +mkdir target\standalone +pushd target\standalone +jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\standalone\1.0-SNAPSHOT\standalone-1.0-SNAPSHOT-bin.zip" +popd +java %java_debug_set% -jar target\standalone\bin\launcher.jar --classpath "%USERPROFILE%\.m2\repository\org\apache\tuscany\samples\sca\sample-supplychain\1.0-SNAPSHOT\sample-supplychain-1.0-SNAPSHOT.jar" %* diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Customer.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Customer.java new file mode 100644 index 0000000000..8088001898 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Customer.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.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/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/CustomerComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/CustomerComponentImpl.java new file mode 100644 index 0000000000..72707e91da --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/CustomerComponentImpl.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the Customer service component. + */ +@Service(Customer.class) +@Scope("COMPOSITE") +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/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Retailer.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Retailer.java new file mode 100644 index 0000000000..1add63fb4e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Retailer.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +/** + * This is the business interface of the Retailer service component. + */ +public interface Retailer { + + public void submitOrder(String order); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/RetailerComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/RetailerComponentImpl.java new file mode 100644 index 0000000000..2af1443d63 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/RetailerComponentImpl.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the Customer service component. + */ +@Service(Retailer.class) +@Scope("COMPOSITE") +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/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Shipper.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Shipper.java new file mode 100644 index 0000000000..d4d49a922b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Shipper.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +/** + * This is the business interface of the Shipper service component. + */ +public interface Shipper { + + public void processShipment(String order); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/ShipperComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/ShipperComponentImpl.java new file mode 100644 index 0000000000..143274a279 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/ShipperComponentImpl.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the Warehouse service component. + */ +@Service(Shipper.class) +@Scope("COMPOSITE") +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/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/SupplyChainClient.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/SupplyChainClient.java new file mode 100644 index 0000000000..2e1f7fca36 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/SupplyChainClient.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * 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 { + SCARuntime.start("supplychain.composite"); + + // Locate the Customer component and invoke it + CompositeContext context = CurrentCompositeContext.getContext(); + Customer customer = + context.locateService(Customer.class, "CustomerComponent"); + + System.out.println("Main thread " + Thread.currentThread()); + customer.purchaseGoods(); + System.out.println("Main thread sleeping ..."); + Thread.sleep(1000); + + SCARuntime.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Warehouse.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Warehouse.java new file mode 100644 index 0000000000..0be499f569 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Warehouse.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +/** + * This is the business interface of the Warehouse service component. + */ +public interface Warehouse { + + public void fulfillOrder(String order); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java new file mode 100644 index 0000000000..cb3e6173bc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the Warehouse service component. + */ +@Service(Warehouse.class) +@Scope("COMPOSITE") +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/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/supplychain.composite b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/supplychain.composite new file mode 100644 index 0000000000..998d92d50b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/supplychain.composite @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java new file mode 100644 index 0000000000..73e765d7f1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * This client program shows how to create an SCA runtime, start it, locate a simple HelloWorld service component and + * invoke it. + */ +public class SupplyChainClientTestCase extends TestCase { + + private Customer customer; + + protected void setUp() throws Exception { + SCARuntime.start("supplychain.composite"); + + CompositeContext context = CurrentCompositeContext.getContext(); + customer = context.locateService(Customer.class, "CustomerComponent"); + } + + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + + public void test() throws Exception { + + System.out.println("Main thread " + Thread.currentThread()); + customer.purchaseGoods(); + System.out.println("Sleeping ..."); + Thread.sleep(1000); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/LICENSE.txt new file mode 100644 index 0000000000..0084319535 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, serviceDefinition marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/pom.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/pom.xml new file mode 100644 index 0000000000..8cde5cfedf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/pom.xml @@ -0,0 +1,49 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + tuscany-sample-webapp + war + Apache Tuscany Simple WebApp Sample + A sample Web Application showing how to use SCA from a JSP. + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/WEB-INF/default.scdl b/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/WEB-INF/default.scdl new file mode 100644 index 0000000000..20cc092cf0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/WEB-INF/default.scdl @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..0398578086 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,26 @@ + + + + + Apache Tuscany Simple Webapp Sample + + + calc.jsp + + + + TuscanyFilter + org.apache.tuscany.runtime.webapp.TuscanyFilter + + + TuscanyFilter + /* + + + + org.apache.tuscany.runtime.webapp.TuscanyContextListener + + diff --git a/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/calc.jsp b/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/calc.jsp new file mode 100644 index 0000000000..83a368dedb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/calc.jsp @@ -0,0 +1,43 @@ +<%@ page import="calculator.CalculatorService" %> +<%@ page import="org.osoa.sca.CompositeContext" %> +<%@ page import="org.osoa.sca.CurrentCompositeContext" %> +<%-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% + CompositeContext context = CurrentCompositeContext.getContext(); + CalculatorService calc = context.locateService(CalculatorService.class, "CalculatorServiceComponent/CalculatorService"); +%> + +Calculator sample + + + + + + + + + + + + +
ExpressionResult
2 + 3<%= calc.add(2, 3) %>
3 - 2<%= calc.subtract(3, 2) %>
+ + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/.ruleset new file mode 100644 index 0000000000..70a035bc01 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/.ruleset @@ -0,0 +1,190 @@ + + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/LICENSE.txt new file mode 100644 index 0000000000..0084319535 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, serviceDefinition marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/pom.xml new file mode 100755 index 0000000000..d54d0558ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/pom.xml @@ -0,0 +1,146 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-axis2 + Apache Tuscany Binding for Axis2 + Implementation of the SCA Web Services binding using Axis2 + + + + org.apache.tuscany.sca.kernel + tuscany-spi + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + ${scaKernelVersion} + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${extensionVersion} + runtime + + + + javax.servlet + servlet-api + 2.5 + + + + org.apache.axis2 + axis2-kernel + + + + org.apache.ws.commons.axiom + axiom-api + + + + org.apache.ws.commons.axiom + axiom-impl + + + + incubator-woden + woden + + + + org.codehaus.woodstox + wstx-asl + + + + commons-logging + commons-logging + + + + org.apache.neethi + neethi + + + + org.apache.ws.commons.schema + XmlSchema + + + + commons-httpclient + commons-httpclient + + + + javax.mail + mail + + + + backport-util-concurrent + backport-util-concurrent + + + + commons-codec + commons-codec + + + + httpcomponents-httpcore + jakarta-httpcore + + + + + org.easymock + easymock + + + + junit + junit + 4.2 + test + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/assembly/axis2.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/assembly/axis2.xml new file mode 100644 index 0000000000..7c835caa5c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/assembly/axis2.xml @@ -0,0 +1,38 @@ + + + + bin + false + + zip + tar.gz + + + + + extension + + org.apache.tuscany.bindings:axis2 + + 644 + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java new file mode 100644 index 0000000000..90f37ba5fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.lang.reflect.InvocationTargetException; +import java.util.LinkedList; +import java.util.concurrent.CountDownLatch; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; + +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.client.OperationClient; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; + +public class Axis2AsyncTargetInvoker extends Axis2TargetInvoker { + + private Axis2ReferenceCallbackTargetInvoker callbackInvoker; + + public Axis2AsyncTargetInvoker(ServiceClient serviceClient, + QName wsdlOperationName, + Options options, + SOAPFactory soapFactory, WorkContext workContext) { + super(serviceClient, wsdlOperationName, options, soapFactory, workContext); + } + + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + throw new InvocationTargetException(new InvocationRuntimeException("Operation not supported")); + } + + private Object invokeTarget(final Object payload, LinkedList callbackRoutingChain) + throws InvocationTargetException { + try { + Object[] args = (Object[]) payload; + OperationClient operationClient = createOperationClient(args); + callbackInvoker.setCallbackRoutingChain(callbackRoutingChain); + Axis2ReferenceCallback callback = new Axis2ReferenceCallback(callbackInvoker); + operationClient.setCallback(callback); + + // FIXME Synchronize with callback thread to get return value + CountDownLatch doneSignal = new CountDownLatch(1); + callbackInvoker.setSignal(doneSignal); + + operationClient.execute(false); + + try { + doneSignal.await(); + } catch(InterruptedException e) { + e.printStackTrace(); + } + + // FIXME returning value from callback thread + Object response = callbackInvoker.getReturnPayload(); + return response; + } catch (AxisFault e) { + throw new InvocationTargetException(e); + } + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object resp = invokeTarget(msg.getBody(), msg.getCallbackRoutingChain()); + msg.setBody(resp); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + public void setCallbackTargetInvoker(Axis2ReferenceCallbackTargetInvoker callbackInvoker) { + this.callbackInvoker = callbackInvoker; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java new file mode 100755 index 0000000000..56725fdf3e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java @@ -0,0 +1,331 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.net.URI; + +import javax.wsdl.Port; +import javax.wsdl.PortType; + +import org.apache.axiom.om.OMElement; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator; +import org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospector; +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry; +import org.apache.tuscany.idl.wsdl.WSDLServiceContract; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.builder.BuilderConfigException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.ReferenceBinding; +import org.apache.tuscany.spi.component.ServiceBinding; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.BindingBuilderExtension; +import org.apache.tuscany.spi.host.ServletHost; +import org.apache.tuscany.spi.idl.InvalidServiceContractException; +import org.apache.tuscany.spi.model.AbstractReferenceDefinition; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.model.ServiceDefinition; +import org.apache.tuscany.spi.wire.IncompatibleServiceContractException; + +/** + * Builds a {@link org.osoa.sca.annotations.Service} or {@link org.apache.tuscany.spi.component.ReferenceBinding} configured + * with the Axis2 binding + * + * @version $Rev$ $Date$ + */ +@SuppressWarnings("deprecation") +public class Axis2BindingBuilder extends BindingBuilderExtension { + private static final String OM_DATA_BINDING = OMElement.class.getName(); + + // TODO: what to do about the base URI? + private static final String BASE_URI = "http://localhost:8080/"; + + private ServletHost servletHost; + + private ConfigurationContext configContext; + + private InterfaceWSDLIntrospector introspector; + + private WorkContext workContext; + + private WSDLDefinitionRegistry wsdlReg; + + public Axis2BindingBuilder() throws BuilderConfigException { + initAxis(); + } + + @Autowire(required = false) + public void setServletHost(ServletHost servletHost) { + this.servletHost = servletHost; + } + + /** + * @param introspector the introspector to set + */ + @Autowire + public void setIntrospector(InterfaceWSDLIntrospector introspector) { + this.introspector = introspector; + } + + @Autowire + public void setWorkContext(WorkContext workContext) { + this.workContext = workContext; + } + + @Autowire + public void setWSDLDefinitionRegistry(WSDLDefinitionRegistry wsdlReg) { + this.wsdlReg = wsdlReg; + } + + @SuppressWarnings("unchecked") + public ServiceBinding build( + CompositeComponent parent, + ServiceDefinition serviceDefinition, + WebServiceBindingDefinition wsBinding, DeploymentContext deploymentContext) { + + try { + // Set the default databinding + ServiceContract outboundContract = serviceDefinition.getServiceContract(); + if (outboundContract instanceof WSDLServiceContract) { + outboundContract.setDataBinding(OM_DATA_BINDING); + } + + // TODO: TUSCANY-1148, with no wsdl only works with + if (wsBinding.getWSDLDefinition() == null) { + if (outboundContract instanceof WSDLServiceContract) { + String ns = ((WSDLServiceContract)outboundContract).getPortType().getQName().getNamespaceURI(); + wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns)); + } else { + throw new IllegalStateException(" with no WSDL requires using "); + } + } + + // FIXME: We need to define how the WSDL PortType is honored in the case that + // both the service.ws and interface.wsdl are in place. + // The WSDL portType from the WSDL Port decides the incoming SOAP message format + // There are also cases that interface.java is used. + + ServiceContract inboundContract; + Port port = wsBinding.getWSDLPort(); + if (port == null) { + // FIXME: [rfeng] No WSDL is referenced by service.ws, we need to create one from + // the outbound service contract if it's JavaServiceContract + inboundContract = outboundContract; + } + + PortType portType = wsBinding.getWSDLPort().getBinding().getPortType(); + inboundContract = introspector.introspect(portType); + + // FIXME: + inboundContract.setInterfaceClass(serviceDefinition.getServiceContract().getInterfaceClass()); + inboundContract.setDataBinding(OM_DATA_BINDING); + inboundContract.setCallbackName(serviceDefinition.getServiceContract().getCallbackName()); + inboundContract.setInteractionScope(serviceDefinition.getServiceContract().getInteractionScope()); + try { + wireService.checkCompatibility(inboundContract, outboundContract, true); + } catch (IncompatibleServiceContractException e) { + throw new Axis2BindingBuilderRuntimeException(e); + } + + String axisServiceName; + if (wsBinding.isSpec10Compliant()) { + wsBinding.setActualURI(computeActualURI(wsBinding, BASE_URI, serviceDefinition.getTarget(), serviceDefinition.getName(), parent)); + axisServiceName = wsBinding.getActualURI().getPath(); + if (axisServiceName != null && axisServiceName.length() > 1 && axisServiceName.startsWith("/")) { + axisServiceName = axisServiceName.substring(1); + } + } else { + axisServiceName = serviceDefinition.getName(); + } + + ServiceBinding serviceBinding = + new Axis2ServiceBinding(axisServiceName, outboundContract, inboundContract, parent, wsBinding, + servletHost, configContext, workContext); + return serviceBinding; + + } catch (InvalidServiceContractException e) { + throw new Axis2BindingBuilderRuntimeException(e); + } + } + + @SuppressWarnings("unchecked") + public ReferenceBinding build( + CompositeComponent parent, + AbstractReferenceDefinition boundReferenceDefinition, + WebServiceBindingDefinition wsBinding, + DeploymentContext deploymentContext) { + + // Set the default binding + ServiceContract inboundContract = boundReferenceDefinition.getServiceContract(); + if (inboundContract instanceof WSDLServiceContract) { + inboundContract.setDataBinding(OM_DATA_BINDING); + } + + // TODO: TUSCANY-1148, with no wsdl only works with + if (wsBinding.getWSDLDefinition() == null) { + if (inboundContract instanceof WSDLServiceContract) { + String ns = ((WSDLServiceContract)inboundContract).getPortType().getQName().getNamespaceURI(); + wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns)); + } else { + throw new IllegalStateException(" with no WSDL requires using "); + } + } + + // FIXME: We need to define how the WSDL PortType is honored in the case that + // both the binding.ws and interface.wsdl are in place + // The WSDL portType from the WSDL Port decides the incoming SOAP message format + + ServiceContract outboundContract = inboundContract; + Port port = wsBinding.getWSDLPort(); + if (port == null) { + // FIXME: [rfeng] No WSDL is referenced by binding.ws, we need to create one from + // the inbound service contract if it's JavaServiceContract + outboundContract = inboundContract; + } + PortType portType = port.getBinding().getPortType(); + try { + outboundContract = introspector.introspect(portType); + } catch (InvalidServiceContractException e) { + new Axis2BindingBuilderRuntimeException(e); + } + + // Set the default databinding + outboundContract.setDataBinding(OM_DATA_BINDING); + //FIXME ... need to figure out how to specify scope on wsdl. + outboundContract.setInteractionScope(inboundContract.getInteractionScope()); + + try { + wireService.checkCompatibility(inboundContract, outboundContract, true); + } catch (IncompatibleServiceContractException e) { + throw new Axis2BindingBuilderRuntimeException(e); + } + + if (wsBinding.isSpec10Compliant()) { + wsBinding.setActualURI(computeActualURI(wsBinding, BASE_URI, null, boundReferenceDefinition.getName(), null)); + } + + return new Axis2ReferenceBinding(boundReferenceDefinition.getName(), parent, wsBinding, + inboundContract, outboundContract, workContext); + + } + + protected Class getBindingType() { + return WebServiceBindingDefinition.class; + } + + protected void initAxis() throws BuilderConfigException { + // TODO: consider having a system component wrapping the Axis2 ConfigContext + try { + this.configContext = new TuscanyAxisConfigurator().getConfigurationContext(); + } catch (AxisFault e) { + throw new BuilderConfigException(e); + } + } + + /** + * Compute the endpoint URI based on section 2.1.1 of the WS binding spec + * 1. The URIs in the endpoint(s) of the referenced WSDL, which may be relative + * 2. The URI specified by the wsa:Address element of the wsa:EndpointReference, which may be relative + * 3. The explicitly stated URI in the "uri" attribute of the binding.ws element, which may be relative, + * 4. The implicit URI as defined by in section 1.7 in the SCA Assembly spec + * If the has no wsdlElement but does have a uri attribute then the uri takes precidence + * over any implicitly used WSDL. + * @param parent + */ + protected URI computeActualURI(WebServiceBindingDefinition wsBinding, String baseURI, URI componentURI, String bindingName, CompositeComponent parent) { + URI wsdlURI = null; + if (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null) { + // explicitly points at a wsdl port, may be a relative URI + wsdlURI = wsBinding.getPortURI(); + } + if (wsdlURI != null && wsdlURI.isAbsolute()) { + if (wsBinding.getURI() != null && (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null)) { + throw new IllegalArgumentException("binding URI cannot be used with absolute WSDL endpoint URI"); + } + return URI.create(wsdlURI.toString()); + } + + // there is no wsdl port endpoint URI or that URI is relative + + URI bindingURI = null; + if (wsBinding.getURI() != null) { + bindingURI = URI.create(wsBinding.getURI()); + } + + if (bindingURI != null && bindingURI.isAbsolute()) { + if (wsdlURI != null) { + return URI.create(bindingURI + "/" + wsdlURI).normalize(); + } else { + return bindingURI; + } + } + + if (componentURI == null) { // null for references + wsdlURI = wsBinding.getPortURI(); + if (bindingURI != null) { + return URI.create(wsdlURI + "/" + bindingURI).normalize(); + } else { + return wsdlURI; + } + } + + + // TODO: TUSCANY-xxx, how to tell if component has multiple services using ? + // boolean singleService = (parent != null) && (((Component)parent.getChild(componentURI.toString())).getInboundWires().size() == 1); + // if (bindingURI == null && !singleService) { + + if (bindingURI == null) { + bindingURI = URI.create(bindingName); + } + + if (componentURI.isAbsolute()) { + if (bindingURI == null && wsdlURI == null) { + return componentURI; + } else if (wsdlURI == null) { + return URI.create(componentURI + "/" + bindingURI).normalize(); + } else if (bindingURI == null) { + return URI.create(componentURI + "/" + wsdlURI).normalize(); + } else { + return URI.create(componentURI + "/" + bindingURI + "/" + wsdlURI).normalize(); + } + } + + String actualURI = ""; + + if (bindingURI == null) { + actualURI = baseURI + "/" + componentURI + "/"; + } else { + actualURI = baseURI + "/" + componentURI + "/" + bindingURI + "/"; + } + + if (wsdlURI != null) { + actualURI = actualURI + wsdlURI.toString(); + } + + if (actualURI.endsWith("/")) { + actualURI = actualURI.substring(0, actualURI.length() -1); + } + + // normalize to handle any . or .. occurances + return URI.create(actualURI).normalize(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.java new file mode 100644 index 0000000000..a5743668a4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + + +/** + * Base class for Exceptions raised during the loading process. Loader implementations should throw a subclass of this + * to indicate the actual problem. + * + * @version $Rev$ $Date$ + */ +public class Axis2BindingBuilderRuntimeException extends Axis2BindingRunTimeException { + private static final long serialVersionUID = -7459051598906813461L; + private String resourceURI; + + public Axis2BindingBuilderRuntimeException() { + } + + public Axis2BindingBuilderRuntimeException(String message) { + super(message); + } + + public Axis2BindingBuilderRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + public Axis2BindingBuilderRuntimeException(Throwable cause) { + super(cause); + } + + /** + * Returns the location of the resource that was being loaded. + * + * @return the location of the resource that was being loaded + */ + public String getResourceURI() { + return resourceURI; + } + + /** + * Sets the location of the resource that was being loaded. + * + * @param resourceURI the location of the resource that was being loaded + */ + public void setResourceURI(String resourceURI) { + this.resourceURI = resourceURI; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java new file mode 100644 index 0000000000..cd957c2ec6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import org.apache.tuscany.api.TuscanyRuntimeException; + +/** + * Denotes an error creating a new object instance + * + * @version $Rev$ $Date$ + */ +public class Axis2BindingRunTimeException extends TuscanyRuntimeException { + private static final long serialVersionUID = -6423113430265944499L; + + public Axis2BindingRunTimeException() { + super(); + } + + public Axis2BindingRunTimeException(String message) { + super(message); + } + + public Axis2BindingRunTimeException(String message, Throwable cause) { + super(message, cause); + } + + public Axis2BindingRunTimeException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java new file mode 100644 index 0000000000..e9aefa7320 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.util.LinkedList; +import java.util.Map; + +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.AbstractOutboundInvocationHandler; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.OutboundInvocationChain; +import org.apache.tuscany.spi.wire.TargetInvoker; + +public class Axis2CallbackInvocationHandler extends AbstractOutboundInvocationHandler { + + private InboundWire inboundWire; + + public Axis2CallbackInvocationHandler(InboundWire inboundWire) { + this.inboundWire = inboundWire; + } + + public Object invoke(Operation operation, Object[] args, LinkedList callbackRoutingChain) throws Throwable { + Object targetAddress = callbackRoutingChain.removeFirst(); + if (targetAddress == null) { + throw new AssertionError("Popped a null from address from stack"); + } + //TODO optimize as this is slow in local invocations + Map, OutboundInvocationChain> sourceCallbackInvocationChains = + inboundWire.getSourceCallbackInvocationChains(targetAddress); + OutboundInvocationChain chain = sourceCallbackInvocationChains.get(operation); + TargetInvoker invoker = chain.getTargetInvoker(); + return invoke(chain, invoker, args, null, callbackRoutingChain); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java new file mode 100644 index 0000000000..23d0fa56de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.lang.reflect.InvocationTargetException; +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.client.OperationClient; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; + +public class Axis2OneWayTargetInvoker extends Axis2TargetInvoker { + + protected static final OMElement RESPONSE = null; + + public Axis2OneWayTargetInvoker(ServiceClient serviceClient, + QName wsdlOperationName, + Options options, + SOAPFactory soapFactory, WorkContext workContext) { + + super(serviceClient, wsdlOperationName, options, soapFactory, workContext); + } + + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + try { + Object[] args = (Object[]) payload; + OperationClient operationClient = createOperationClient(args); + + operationClient.execute(false); + + // REVIEW it seems ok to return null + return RESPONSE; + } catch (AxisFault e) { + throw new InvocationTargetException(e); + } catch (Throwable t) { + throw new Axis2BindingRunTimeException(t); + } + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object resp = invokeTarget(msg.getBody(), NONE); + msg.setBody(resp); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java new file mode 100755 index 0000000000..b0ee16ba3a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java @@ -0,0 +1,194 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.util.Collection; +import javax.wsdl.Definition; +import javax.xml.namespace.QName; + +import static org.osoa.sca.Constants.SCA_NS; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.extension.ReferenceBindingExtension; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.TargetInvoker; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.transport.http.HTTPConstants; +import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator; +import org.apache.tuscany.binding.axis2.util.WebServiceOperationMetaData; +import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData; + +/** + * Axis2Reference uses Axis2 to invoke a remote web service + */ +public class Axis2ReferenceBinding extends ReferenceBindingExtension { + private static final QName BINDING_WS = new QName(SCA_NS, "binding.ws"); + + private WebServicePortMetaData wsPortMetaData; + private ServiceClient serviceClient; + private WorkContext workContext; + + @SuppressWarnings("unchecked") + public Axis2ReferenceBinding(String theName, + CompositeComponent parent, + WebServiceBindingDefinition wsBinding, + ServiceContract contract, + ServiceContract bindingServiceContract, + WorkContext workContext) { + super(theName, parent); + this.bindingServiceContract = bindingServiceContract; + this.workContext = workContext; + try { + Definition wsdlDefinition = wsBinding.getWSDLDefinition(); + if (wsBinding.isSpec10Compliant()) { + wsPortMetaData = + new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getActualURI().toString(), false); + } else { + wsPortMetaData = + new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getURI(), false); + } + serviceClient = createServiceClient(wsdlDefinition, wsPortMetaData); + } catch (AxisFault e) { + throw new Axis2BindingRunTimeException(e); + } + } + + public QName getBindingType() { + return BINDING_WS; + } + + public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) { + Axis2TargetInvoker invoker; + try { + boolean operationHasCallback = contract.getCallbackName() != null; + if (operationHasCallback) { + // FIXME: SDODataBinding needs to pass in TypeHelper and classLoader + // as parameters. + Axis2AsyncTargetInvoker asyncInvoker = + (Axis2AsyncTargetInvoker) createOperationInvoker(serviceClient, + operation, + wsPortMetaData, + true, + false); + // FIXME: This makes the (BIG) assumption that there is only one + // callback method + // Relaxing this assumption, however, does not seem to be trivial, + // it may depend on knowledge + // of what actual callback method was invoked by the service at the + // other end + Operation callbackOperation = findCallbackOperation(); + Axis2CallbackInvocationHandler invocationHandler = + new Axis2CallbackInvocationHandler(inboundWire); + Axis2ReferenceCallbackTargetInvoker callbackInvoker = + new Axis2ReferenceCallbackTargetInvoker(callbackOperation, inboundWire, invocationHandler); + asyncInvoker.setCallbackTargetInvoker(callbackInvoker); + + invoker = asyncInvoker; + } else { + boolean isOneWay = operation.isNonBlocking(); + invoker = createOperationInvoker(serviceClient, operation, wsPortMetaData, false, isOneWay); + } + } catch (AxisFault e) { + throw new Axis2BindingRunTimeException(e); + } + return invoker; + } + + private Operation findCallbackOperation() { + ServiceContract contract = inboundWire.getServiceContract(); + Operation callbackOperation = null; + Collection callbackOperations = contract.getCallbackOperations().values(); + if (callbackOperations.size() != 1) { + throw new Axis2BindingRunTimeException("Can only handle one callback operation"); + } else { + callbackOperation = (Operation) callbackOperations.iterator().next(); + } + return callbackOperation; + } + + /** + * Create an Axis2 ServiceClient + */ + private ServiceClient createServiceClient(Definition wsdlDefinition, WebServicePortMetaData wsPortMetaData) + throws AxisFault { + + TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator(); + ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext(); + QName serviceQName = wsPortMetaData.getServiceName(); + String portName = wsPortMetaData.getPortName().getLocalPart(); + AxisService axisService = + AxisService.createClientSideAxisService(wsdlDefinition, serviceQName, portName, new Options()); + return new ServiceClient(configurationContext, axisService); + } + + /** + * Create and configure an Axis2TargetInvoker for each operations + */ + private Axis2TargetInvoker createOperationInvoker(ServiceClient serviceClient, + Operation m, + WebServicePortMetaData wsPortMetaData, + boolean hasCallback, + boolean isOneWay) throws AxisFault { + SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory(); + String portTypeNS = wsPortMetaData.getPortTypeName().getNamespaceURI(); + + String methodName = m.getName(); + + WebServiceOperationMetaData operationMetaData = wsPortMetaData.getOperationMetaData(methodName); + + Options options = new Options(); + options.setTo(new EndpointReference(wsPortMetaData.getEndpoint())); + options.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE); + + String wsdlOperationName = operationMetaData.getBindingOperation().getOperation().getName(); + + String soapAction = wsPortMetaData.getOperationMetaData(wsdlOperationName).getSOAPAction(); + if (soapAction != null && soapAction.length() > 1) { + options.setAction(soapAction); + } + + options.setTimeOutInMilliSeconds(5 * 60 * 1000); + + QName wsdlOperationQName = new QName(portTypeNS, wsdlOperationName); + + Axis2TargetInvoker invoker; + if (hasCallback) { + invoker = + new Axis2AsyncTargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory, workContext); + } else if (isOneWay) { + invoker = + new Axis2OneWayTargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory, workContext); + } else { + invoker = new Axis2TargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory, workContext); + } + + return invoker; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java new file mode 100644 index 0000000000..ca129ca1cc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.axiom.om.OMElement; +import org.apache.axis2.client.async.AsyncResult; +import org.apache.axis2.client.async.Callback; +import org.apache.axis2.context.MessageContext; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.TargetInvoker; + +public class Axis2ReferenceCallback extends Callback { + + private Axis2ReferenceCallbackTargetInvoker targetInvoker; + + public Axis2ReferenceCallback(Axis2ReferenceCallbackTargetInvoker targetInvoker) { + this.targetInvoker = targetInvoker; + } + + public void onComplete(AsyncResult result) { + MessageContext responseMC = result.getResponseMessageContext(); + OMElement responseOM = responseMC.getEnvelope().getBody().getFirstElement(); + try { + targetInvoker.invokeTarget(new Object[] {responseOM}, TargetInvoker.NONE); + } catch (InvocationTargetException e) { + // FIXME what is the appropriate exception here? + throw new InvocationRuntimeException(e); + } + } + + public void setComplete(boolean complete) { + super.setComplete(complete); + } + + public void onError(Exception e) { + throw new InvocationRuntimeException(e); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java new file mode 100644 index 0000000000..cdc975b54e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java @@ -0,0 +1,114 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.lang.reflect.InvocationTargetException; +import java.util.LinkedList; +import java.util.concurrent.CountDownLatch; + +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.TargetInvoker; + +public class Axis2ReferenceCallbackTargetInvoker implements TargetInvoker { + + private Operation operation; + private InboundWire inboundWire; + private LinkedList callbackRoutingChain; + private boolean cacheable; + Axis2CallbackInvocationHandler invocationHandler; + private CountDownLatch signal; + private Object returnPayload; + + public Axis2ReferenceCallbackTargetInvoker(Operation operation, + InboundWire inboundWire, + Axis2CallbackInvocationHandler invocationHandler) { + + this.operation = operation; + this.inboundWire = inboundWire; + this.invocationHandler = invocationHandler; + } + + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + Object[] args; + if (payload != null && !payload.getClass().isArray()) { + args = new Object[]{payload}; + returnPayload = payload; + } else { + args = (Object[]) payload; + returnPayload = args[0]; + } + // FIXME synchronize with forward thread to return value + signal.countDown(); + try { + return invocationHandler.invoke(operation, args, callbackRoutingChain); + } catch (Throwable t) { + t.printStackTrace(); + throw new InvocationTargetException(t); + } + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object resp = invokeTarget(msg.getBody(), NONE); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBodyWithFault(e.getCause()); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + public boolean isCacheable() { + return cacheable; + } + + public void setCacheable(boolean cacheable) { + this.cacheable = cacheable; + } + + public boolean isOptimizable() { + return isCacheable(); // we only need to check if the scopes are correct + } + + public Axis2ReferenceCallbackTargetInvoker clone() throws CloneNotSupportedException { + Axis2ReferenceCallbackTargetInvoker invoker = (Axis2ReferenceCallbackTargetInvoker) super.clone(); + invoker.operation = this.operation; + invoker.inboundWire = this.inboundWire; + invoker.callbackRoutingChain = this.callbackRoutingChain; + invoker.cacheable = this.cacheable; + invoker.invocationHandler = this.invocationHandler; + return invoker; + } + + public void setCallbackRoutingChain(LinkedList callbackRoutingChain) { + this.callbackRoutingChain = callbackRoutingChain; + } + + public void setSignal(CountDownLatch signal) { + this.signal = signal; + } + + public Object getReturnPayload() { + return returnPayload; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java new file mode 100755 index 0000000000..d7e04ca917 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java @@ -0,0 +1,390 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import static org.osoa.sca.Constants.SCA_NS; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.CountDownLatch; + +import javax.wsdl.Definition; +import javax.wsdl.Operation; +import javax.wsdl.PortType; +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.description.AxisOperation; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.Parameter; +import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; +import org.apache.axis2.description.WSDLToAxisServiceBuilder; +import org.apache.axis2.engine.MessageReceiver; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004Constants; +import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData; +import org.apache.tuscany.spi.builder.BuilderConfigException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.TargetInvokerCreationException; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.extension.ServiceBindingExtension; +import org.apache.tuscany.spi.host.ServletHost; +import org.apache.tuscany.spi.model.InteractionScope; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.Interceptor; +import org.apache.tuscany.spi.wire.InvocationChain; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.MessageImpl; +import org.apache.tuscany.spi.wire.TargetInvoker; +import org.osoa.sca.annotations.Destroy; + +// org.apache.tuscany.spi.model +/** + * An implementation of a {@link ServiceBindingExtension} configured with the Axis2 binding + * + * @version $Rev$ $Date$ + */ +public class Axis2ServiceBinding extends ServiceBindingExtension { + private static final QName BINDING_WS = new QName(SCA_NS, "binding.ws"); + + private ServiceContract serviceContract; + + private ServletHost servletHost; + + private ConfigurationContext configContext; + + private WebServiceBindingDefinition binding; + + private Map invCtxMap = new HashMap(); + + private String serviceName; + + private WorkContext workContext; + + private Boolean conversational = null; + + private Set seenConversations = Collections.synchronizedSet(new HashSet()); + + public Axis2ServiceBinding(String theName, + ServiceContract serviceContract, + ServiceContract serviceBindingContract, + CompositeComponent parent, + WebServiceBindingDefinition binding, + ServletHost servletHost, + ConfigurationContext configContext, + WorkContext workContext) { + + super(theName, parent); + + this.serviceContract = serviceContract; + this.bindingServiceContract = serviceBindingContract; + this.binding = binding; + this.servletHost = servletHost; + this.configContext = configContext; + this.serviceName = theName; + this.workContext = workContext; + } + + public void start() { + super.start(); + + try { + configContext.getAxisConfiguration().addService(createAxisService(binding)); + } catch (AxisFault e) { + throw new Axis2BindingRunTimeException(e); + } + + Axis2ServiceServlet servlet = new Axis2ServiceServlet(); + servlet.init(configContext); + configContext.setContextRoot(getName()); + if (binding.isSpec10Compliant()) { + // TODO: TUSCANY-xxx, sort out what to do with system base URI etc + servletHost.registerMapping(binding.getActualURI().getPath(), servlet); + } else { + servletHost.registerMapping("/services/" + getName(), servlet); + } + } + + @Destroy + public void stop() { + if (binding.isSpec10Compliant()) { + servletHost.unregisterMapping(binding.getActualURI().getPath()); + } else { + servletHost.unregisterMapping("/services/" + getName()); + } + try { + configContext.getAxisConfiguration().removeService(getName()); + } catch (AxisFault e) { + throw new Axis2BindingRunTimeException(e); + } + super.stop(); + } + + private AxisService createAxisService(WebServiceBindingDefinition wsBinding) throws AxisFault { + Definition definition = wsBinding.getWSDLDefinition(); + WebServicePortMetaData wsdlPortInfo = + new WebServicePortMetaData(definition, wsBinding.getWSDLPort(), null, false); + + // TODO investigate if this is 20 wsdl what todo? + WSDLToAxisServiceBuilder builder = + new WSDL11ToAxisServiceBuilder(definition, wsdlPortInfo.getServiceName(), wsdlPortInfo.getPort() + .getName()); + builder.setServerSide(true); + AxisService axisService = builder.populateService(); + + axisService.setName(this.getName()); + axisService.setServiceDescription("Tuscany configured AxisService for service: '" + this.getName() + + "'"); + + // Use the existing WSDL + Parameter wsdlParam = new Parameter(WSDLConstants.WSDL_4_J_DEFINITION, null); + wsdlParam.setValue(definition); + axisService.addParameter(wsdlParam); + Parameter userWSDL = new Parameter("useOriginalwsdl", "true"); + axisService.addParameter(userWSDL); + + PortType wsdlPortType = wsdlPortInfo.getPortType(); + for (Object o : wsdlPortType.getOperations()) { + Operation wsdlOperation = (Operation) o; + String operationName = wsdlOperation.getName(); + QName operationQN = new QName(definition.getTargetNamespace(), operationName); + + org.apache.tuscany.spi.model.Operation op = serviceContract.getOperations().get(operationName); + + MessageReceiver msgrec = null; + boolean opIsNonBlocking = op.isNonBlocking(); + if (serviceContract.getCallbackName() != null) { + msgrec = new Axis2ServiceInOutAsyncMessageReceiver(this, op); + } else if (opIsNonBlocking) { + msgrec = new Axis2ServiceInMessageReceiver(this, op); + } else { + msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op); + } + + AxisOperation axisOp = axisService.getOperation(operationQN); + if (opIsNonBlocking) { + axisOp.setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_IN_ONLY); + } else { + axisOp.setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_IN_OUT); + } + axisOp.setMessageReceiver(msgrec); + } + + return axisService; + } + + public Object invokeTarget(org.apache.tuscany.spi.model.Operation op, Object[] args, Object messageId, + String conversationID) + throws InvocationTargetException { + InvocationChain chain = inboundWire.getInvocationChains().get(op); + Interceptor headInterceptor = chain.getHeadInterceptor(); + String oldConversationID = (String) workContext.getIdentifier(Scope.CONVERSATION); + if (isConversational() && conversationID != null) { + workContext.setIdentifier(Scope.CONVERSATION, conversationID); + } else { + workContext.clearIdentifier(Scope.CONVERSATION); + } + try { + if (headInterceptor == null) { + // short-circuit the dispatch and invoke the target directly + TargetInvoker targetInvoker = chain.getTargetInvoker(); + if (targetInvoker == null) { + throw new AssertionError("No target invoker [" + chain.getOperation().getName() + "]"); + } + return targetInvoker.invokeTarget(args, TargetInvoker.NONE); + } else { + + Message msg = new MessageImpl(); + msg.setTargetInvoker(chain.getTargetInvoker()); + msg.pushFromAddress(getFromAddress()); + if (messageId != null) { + msg.setMessageId(messageId); + } + msg.setBody(args); + Message resp; + + if (isConversational()) { + + + int opSeq = op.getConversationSequence(); + if (opSeq == org.apache.tuscany.spi.model.Operation.CONVERSATION_END) { + assert seenConversations + .contains(conversationID) : "End of conversation called when no conversation existed"; + msg.setConversationSequence(TargetInvoker.END); + seenConversations.remove(conversationID); //if a fault occurs does the conversation end? + //how do I know if a component called locally another opeation that ended this conversation? + + } else { + boolean ec = seenConversations.contains(conversationID); + if (ec) { + + msg.setConversationSequence(TargetInvoker.CONTINUE); + } else { + seenConversations.add(conversationID); + msg.setConversationSequence(TargetInvoker.START); + } + } + + } + // dispatch the wire down the chain and get the response + resp = headInterceptor.invoke(msg); + Object body = resp.getBody(); + if (resp.isFault()) { + throw new InvocationTargetException((Throwable) body); + } + return body; + } + } finally { + if (null != oldConversationID) { + workContext.setIdentifier(Scope.CONVERSATION, conversationID); + } else { + workContext.clearIdentifier(Scope.CONVERSATION); + } + } + } + + protected Object getFromAddress() { + return this.serviceName; + } + + /** + * Get the Method from an interface matching the WSDL operation name + */ + protected Method getMethod(Class serviceInterface, String operationName) throws BuilderConfigException { + // Note: this doesn't support overloaded operations + Method[] methods = serviceInterface.getMethods(); + for (Method m : methods) { + if (m.getName().equals(operationName)) { + return m; + } + // tolerate WSDL with capatalized operation name + StringBuilder sb = new StringBuilder(operationName); + sb.setCharAt(0, Character.toLowerCase(sb.charAt(0))); + if (m.getName().equals(sb.toString())) { + return m; + } + } + throw new BuilderConfigException("no operation named " + operationName + + " found on service interface: " + + serviceInterface.getName()); + } + + public QName getBindingType() { + return BINDING_WS; + } + + public TargetInvoker createTargetInvoker(ServiceContract contract, org.apache.tuscany.spi.model.Operation operation) + throws TargetInvokerCreationException { + if (!operation.isCallback()) { + throw new UnsupportedOperationException(); + } else { + return new Axis2ServiceCallbackTargetInvoker(this); + } + } + + public void addMapping(Object msgId, InvocationContext invCtx) { + this.invCtxMap.put(msgId, invCtx); + } + + public InvocationContext retrieveMapping(Object msgId) { + return this.invCtxMap.get(msgId); + } + + public void removeMapping(Object msgId) { + this.invCtxMap.remove(msgId); + } + + /** + * @param inMC + * @return + */ + protected static String getConversationID(MessageContext inMC) { + String conversationID = null; + Iterator i = inMC.getEnvelope().getHeader() + .getChildrenWithName(new QName("http://www.w3.org/2005/08/addressing", "From")); + for (; i.hasNext();) { + Object a = i.next(); + if (a instanceof OMElement) { + OMElement ao = (OMElement) a; + for (Iterator rpI = + ao.getChildrenWithName(new QName("http://www.w3.org/2005/08/addressing", "ReferenceParameters")); + rpI.hasNext();) { + OMElement rpE = (OMElement) rpI.next(); + for ( + Iterator cidI = rpE.getChildrenWithName(WebServiceBindingDefinition.CONVERSATION_ID_REFPARM_QN); + cidI.hasNext();) { + OMElement cidE = (OMElement) cidI.next(); + conversationID = cidE.getText(); + } + } + + } + + } + return conversationID; + } + + protected class InvocationContext { + public MessageContext inMessageContext; + + public org.apache.tuscany.spi.model.Operation operation; + + public SOAPFactory soapFactory; + + public CountDownLatch doneSignal; + + public InvocationContext(MessageContext messageCtx, + org.apache.tuscany.spi.model.Operation operation, + SOAPFactory soapFactory, + CountDownLatch doneSignal) { + this.inMessageContext = messageCtx; + this.operation = operation; + this.soapFactory = soapFactory; + this.doneSignal = doneSignal; + } + } + + WorkContext getWorkContext() { + return workContext; + } + + boolean isConversational() { + if (conversational == null) { + conversational = serviceContract.getInteractionScope() == InteractionScope.CONVERSATIONAL; + + } + return conversational; + } + + @Override + public boolean allowsPassByReference() { + return true; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java new file mode 100644 index 0000000000..7ec4a13669 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.TargetInvoker; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axis2.AxisFault; +import org.apache.axis2.Constants; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.engine.AxisEngine; +import org.apache.axis2.util.Utils; +import org.apache.tuscany.binding.axis2.Axis2ServiceBinding.InvocationContext; + +public class Axis2ServiceCallbackTargetInvoker implements TargetInvoker { + + private Axis2ServiceBinding service; + + protected static final OMElement RESPONSE = null; + + public Axis2ServiceCallbackTargetInvoker(Axis2ServiceBinding service) { + this.service = service; + } + + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + throw new InvocationTargetException(new InvocationRuntimeException("Operation not supported")); + } + + private Object invokeTarget(final Object payload, Object correlationId) throws InvocationTargetException { + try { + // Use current correlation id as index to retrieve inv context + InvocationContext invCtx = service.retrieveMapping(correlationId); + + MessageContext outMC = Utils.createOutMessageContext(invCtx.inMessageContext); + outMC.getOperationContext().addMessageContext(outMC); + + OMElement responseOM; + if (payload != null && !payload.getClass().isArray()) { + responseOM = (OMElement) payload; + } else { + responseOM = (OMElement) ((Object[]) payload)[0]; + } + SOAPEnvelope soapEnvelope = invCtx.soapFactory.getDefaultEnvelope(); + soapEnvelope.getBody().addChild(responseOM); + outMC.setEnvelope(soapEnvelope); + outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE); + + AxisEngine engine = + new AxisEngine( + invCtx.inMessageContext.getOperationContext().getServiceContext().getConfigurationContext()); + engine.send(outMC); + + invCtx.doneSignal.countDown(); + + service.removeMapping(correlationId); + } catch (AxisFault e) { + throw new InvocationTargetException(e); + } catch (Throwable t) { + throw new Axis2BindingRunTimeException(t); + } + + return RESPONSE; + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object correlationId = msg.getCorrelationId(); + if (correlationId == null) { + throw new InvocationRuntimeException("Missing correlation id"); + } + Object resp = invokeTarget(msg.getBody(), correlationId); + msg.setBody(resp); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + public Axis2ServiceCallbackTargetInvoker clone() throws CloneNotSupportedException { + try { + return (Axis2ServiceCallbackTargetInvoker) super.clone(); + } catch (CloneNotSupportedException e) { + // will not happen + return null; + } + } + + public boolean isCacheable() { + return true; + } + + public void setCacheable(boolean cacheable) { + + } + + public boolean isOptimizable() { + return false; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java new file mode 100644 index 0000000000..53b85ea887 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.axiom.om.OMElement; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.receivers.AbstractInMessageReceiver; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; + +public class Axis2ServiceInMessageReceiver extends AbstractInMessageReceiver { + + protected Operation operation; + + private Axis2ServiceBinding axis2Service; + + public Axis2ServiceInMessageReceiver(Axis2ServiceBinding service, Operation operation) { + this.axis2Service = service; + this.operation = operation; + } + + public Axis2ServiceInMessageReceiver() { + + } + + @Override + public void invokeBusinessLogic(MessageContext inMC) throws AxisFault { + try { + OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement(); + Object[] args = new Object[] {requestOM}; + String conversationID = axis2Service.isConversational() ? Axis2ServiceBinding.getConversationID(inMC) : null; + + axis2Service.invokeTarget(operation, args, null, conversationID); + + } catch (InvocationTargetException e) { + Throwable t = e.getCause(); + if (t instanceof Exception) { + throw AxisFault.makeFault((Exception)t); + } + throw new InvocationRuntimeException(e); + } catch (Throwable t) { + if (t instanceof Exception) { + throw AxisFault.makeFault((Exception)t); + } + throw new Axis2BindingRunTimeException(t); + } + + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java new file mode 100644 index 0000000000..9d7b711701 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.CountDownLatch; + +import org.apache.axiom.om.OMElement; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.receivers.AbstractMessageReceiver; +import org.apache.tuscany.binding.axis2.Axis2ServiceBinding.InvocationContext; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.MessageId; + +public class Axis2ServiceInOutAsyncMessageReceiver extends AbstractMessageReceiver { + + private Operation operation; + + private Axis2ServiceBinding service; + + public Axis2ServiceInOutAsyncMessageReceiver(Axis2ServiceBinding service, + Operation operation) { + this.operation = operation; + this.service = service; + } + + public Axis2ServiceInOutAsyncMessageReceiver() { + } + + public final void receive(final MessageContext messageCtx) { + try { + Object messageId = messageCtx.getMessageID(); + if (messageId == null) { + messageId = new MessageId(); + } + + // Now use message id as index to context to be used by callback + // target invoker + CountDownLatch doneSignal = new CountDownLatch(1); + InvocationContext invCtx = + service.new InvocationContext(messageCtx, operation, getSOAPFactory(messageCtx), doneSignal); + service.addMapping(messageId, invCtx); + + invokeBusinessLogic(messageCtx, messageId); + + try { + doneSignal.await(); + } catch(InterruptedException e) { + e.printStackTrace(); + } + } catch (AxisFault e) { + // log.error(e); + } + } + + private void invokeBusinessLogic(MessageContext inMC, Object messageId) throws AxisFault { + try { + OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement(); + Object[] args = new Object[] {requestOM}; + String conversationID = service.isConversational() ? Axis2ServiceBinding.getConversationID(inMC) : null; + service.invokeTarget(operation, args, messageId, conversationID); + } catch (InvocationTargetException e) { + Throwable t = e.getCause(); + if (t instanceof Exception) { + throw AxisFault.makeFault((Exception)t); + } + throw new InvocationRuntimeException(e); + } catch (Exception e) { + throw AxisFault.makeFault(e); + } + + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java new file mode 100644 index 0000000000..8af613450d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.lang.reflect.InvocationTargetException; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axis2.AxisFault; +import org.apache.axis2.Constants; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver; +import org.apache.tuscany.spi.idl.ServiceFaultException; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; + +public class Axis2ServiceInOutSyncMessageReceiver extends AbstractInOutSyncMessageReceiver { + + protected Operation operation; + + private Axis2ServiceBinding axis2Service; + + public Axis2ServiceInOutSyncMessageReceiver(Axis2ServiceBinding service, Operation operation) { + this.axis2Service = service; + this.operation = operation; + } + + public Axis2ServiceInOutSyncMessageReceiver() { + + } + + @Override + public void invokeBusinessLogic(MessageContext inMC, MessageContext outMC) throws AxisFault { + QName envQName = null; + try { + envQName= inMC.getEnvelope().getQName(); + OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement(); + Object[] args = new Object[] {requestOM}; + + String conversationID = axis2Service.isConversational() ? Axis2ServiceBinding.getConversationID(inMC) : null; + + OMElement responseOM = (OMElement)axis2Service.invokeTarget(operation, args, null, conversationID); + + + SOAPEnvelope soapEnvelope = getSOAPFactory(inMC).getDefaultEnvelope(); + if(null != responseOM ){ + soapEnvelope.getBody().addChild(responseOM); + } + outMC.setEnvelope(soapEnvelope); + outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE); + + } catch (InvocationTargetException e) { + // e.printStackTrace(); + throw processMessageFault(envQName.getNamespaceURI(), e.getCause()); + } catch(InvocationRuntimeException e){ + // e.printStackTrace(); + throw processMessageFault(envQName.getNamespaceURI(), e.getCause()); + } catch (AxisFault e) { + // e.printStackTrace(); + throw e; + } catch (Exception e) { + // e.printStackTrace(); + throw AxisFault.makeFault(e); + } + } + + /** + * @param envQName + * @param e + * @throws AxisFault + */ + private AxisFault processMessageFault(String nsURI, Throwable t) { + + if (t instanceof ServiceFaultException) { //Business fault. + OMElement faultdetail = null; + String reason = ""; + + ServiceFaultException sfe = (ServiceFaultException)t; + reason= sfe.getMessage(); + reason = reason == null ? "" : reason; + Object finfo = sfe.getFaultInfo(); + + if (finfo instanceof OMElement) { + faultdetail = (OMElement)finfo; + + } + QName faultCode= new QName(nsURI , + org.apache.axiom.soap.SOAP12Constants.SOAP_FAULT_VALUE_SENDER); + return new AxisFault(faultCode, reason, null, null, faultdetail); + + + } else if ( t instanceof Exception) { + return AxisFault.makeFault((Exception) t); + } + + + return new AxisFault(t); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java new file mode 100644 index 0000000000..74b79de3ed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java @@ -0,0 +1,211 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Collections; +import java.util.Enumeration; +import java.util.Set; +import java.util.Vector; + +import javax.servlet.RequestDispatcher; +import javax.servlet.Servlet; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.transport.http.AxisServlet; + +/** + * This overrides the servlet init of the AxisServlet so Tuscany can use + * a single Axis2 ConfigurationContext instance shared between AxisServlet + * instances for each SCA service with a ws binding. + * TODO: need to review if thats really what we want to be doing + */ +public class Axis2ServiceServlet extends AxisServlet { + + private static final long serialVersionUID = 1L; + + private static final ServletConfig DUMMY_CONFIG = createDummyServletConfig(); + + private boolean inited; + + public void init(ConfigurationContext configContext) { + this.configContext = configContext; + try { + super.init(DUMMY_CONFIG); + } catch (ServletException e) { + throw new RuntimeException(e); + } + } + + /** + * We've setup the Servlet by passing in a ConfigurationContext on our init method + * override this method to just return that + */ + @Override + protected ConfigurationContext initConfigContext(ServletConfig config) throws ServletException { + return this.configContext; + } + + /** + * The AxisServlet gets NPE during init without a ServletConfig so this is a mocked up one to prevent that. + */ + private static ServletConfig createDummyServletConfig() { + ServletConfig sc = new ServletConfig() { + + public String getServletName() { + return "TuscanyAxis2DummyServlet"; + } + + public ServletContext getServletContext() { + return new ServletContext() { + + public ServletContext getContext(String uripath) { + return null; + } + + public String getContextPath() { + return null; + } + + public int getMajorVersion() { + return 0; + } + + public int getMinorVersion() { + return 0; + } + + public String getMimeType(String file) { + return null; + } + + public Set getResourcePaths(String path) { + return Collections.emptySet(); + } + + public URL getResource(String path) throws MalformedURLException { + if("/".equals(path)) { + // HACK: To avoid NPE + return new URL("/axis2"); + } + return null; + } + + public InputStream getResourceAsStream(String path) { + return null; + } + + public RequestDispatcher getRequestDispatcher(String path) { + return null; + } + + public RequestDispatcher getNamedDispatcher(String arg0) { + return null; + } + + public Servlet getServlet(String arg0) throws ServletException { + return null; + } + + public Enumeration getServlets() { + return null; + } + + public Enumeration getServletNames() { + return null; + } + + public void log(String arg0) { + } + + public void log(Exception arg0, String arg1) { + } + + public void log(String arg0, Throwable arg1) { + } + + public String getRealPath(String arg0) { + return null; + } + + public String getServerInfo() { + return null; + } + + public String getInitParameter(String arg0) { + return null; + } + + public Enumeration getInitParameterNames() { + return null; + } + + public Object getAttribute(String arg0) { + return null; + } + + public Enumeration getAttributeNames() { + return null; + } + + public void setAttribute(String arg0, Object arg1) { + } + + public void removeAttribute(String arg0) { + } + + public String getServletContextName() { + return null; + } + }; + } + + public String getInitParameter(String arg0) { + return null; + } + + public Enumeration getInitParameterNames() { + return new Vector().elements(); + } + }; + return sc; + } + + @Override + protected void service(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + // HACK: Get the correct context root which is not available during init() call + if (!inited) { + synchronized (configContext) { + configContext.setContextRoot(request.getContextPath()); + inited = true; + } + } + super.service(request, response); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java new file mode 100755 index 0000000000..52768b973c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java @@ -0,0 +1,186 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.lang.reflect.InvocationTargetException; +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.idl.ServiceFaultException; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.TargetInvoker; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPBody; +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axiom.soap.SOAPHeader; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.AddressingConstants; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.OperationClient; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.wsdl.WSDLConstants; + +/** + * Axis2TargetInvoker uses an Axis2 OperationClient to invoke a remote web + * service + */ +public class Axis2TargetInvoker implements TargetInvoker { + + private QName wsdlOperationName; + + private Options options; + + private SOAPFactory soapFactory; + + private ServiceClient serviceClient; + + private WorkContext workContext; + + public Axis2TargetInvoker(ServiceClient serviceClient, + QName wsdlOperationName, + Options options, + SOAPFactory soapFactory, + WorkContext workContext) { + this.wsdlOperationName = wsdlOperationName; + this.options = options; + this.soapFactory = soapFactory; + this.serviceClient = serviceClient; + this.workContext = workContext; + } + + /** + * Invoke a WS operation + * + * @param payload + * @param sequence + * @return + * @throws InvocationTargetException + */ + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + try { + Object[] args = (Object[])payload; + OperationClient operationClient = createOperationClient(args); + + operationClient.execute(true); + + MessageContext responseMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); + + return responseMC.getEnvelope().getBody().getFirstElement(); + + } catch (AxisFault e) { + // convert exception to an exception independent on Axis runtime. + Throwable cause = e.getCause(); + cause = cause == null ? e : cause; + ServiceFaultException serviceFaultException = + new ServiceFaultException(e.getMessage(), e.getDetail(), cause); + OMElement detail = e.getDetail(); + if (null != detail) { + detail.getQName(); + serviceFaultException.setLogical(detail.getQName()); + } + throw new InvocationTargetException(serviceFaultException); + + } + + } + + @SuppressWarnings("deprecation") + protected OperationClient createOperationClient(Object[] args) throws AxisFault { + SOAPEnvelope env = soapFactory.getDefaultEnvelope(); + if (args != null && args.length > 0) { + SOAPBody body = env.getBody(); + for (Object bc : args) { + if (bc instanceof OMElement) { + body.addChild((OMElement)bc); + } else { + throw new IllegalArgumentException( + "Can't handle mixed payloads betweem OMElements and other types."); + } + } + } + MessageContext requestMC = new MessageContext(); + requestMC.setEnvelope(env); + // Axis2 operationClients can not be shared so create a new one for each + // request + OperationClient operationClient = serviceClient.createClient(wsdlOperationName); + + if (workContext != null) { + String conversationId = (String)workContext.getIdentifier(Scope.CONVERSATION); + if (conversationId != null && conversationId.length() != 0) { + EndpointReference fromEPR = new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL); + fromEPR.addReferenceParameter(WebServiceBindingDefinition.CONVERSATION_ID_REFPARM_QN, conversationId); + options.setFrom(fromEPR); + requestMC.setFrom(fromEPR); // who knows why two ways ? + + // For now do this the brute force method. Need to figure out + // how to do axis addressing .. configure mar in flow. + SOAPEnvelope sev = requestMC.getEnvelope(); + SOAPHeader sh = sev.getHeader(); + OMElement el = + fromEPR.toOM(AddressingConstants.Final.WSA_NAMESPACE, + AddressingConstants.WSA_FROM, + AddressingConstants.WSA_DEFAULT_PREFIX); + sh.addChild(el); + } + + } + + operationClient.setOptions(options); + operationClient.addMessageContext(requestMC); + return operationClient; + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object resp = invokeTarget(msg.getBody(), NONE); + msg.setBody(resp); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + public Axis2TargetInvoker clone() throws CloneNotSupportedException { + try { + return (Axis2TargetInvoker)super.clone(); + } catch (CloneNotSupportedException e) { + // will not happen + return null; + } + } + + public boolean isCacheable() { + return true; + } + + public void setCacheable(boolean cacheable) { + + } + + public boolean isOptimizable() { + return false; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java new file mode 100644 index 0000000000..64ccb94193 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.binding.axis2; + +import java.net.URI; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.HandlerDescription; +import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.engine.RequestURIBasedDispatcher; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + */ +public class TuscanyDispatcher extends RequestURIBasedDispatcher { + + public static final String NAME = "TuscanyDispatcher"; + private static final Log log = LogFactory.getLog(RequestURIBasedDispatcher.class); + private static final boolean isDebugEnabled = log.isDebugEnabled(); + + /* + * (non-Javadoc) + * + * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext) + */ + public AxisService findService(MessageContext messageContext) throws AxisFault { + EndpointReference toEPR = messageContext.getTo(); + + if (toEPR != null) { + if(isDebugEnabled){ + log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress()); + } + + String path = URI.create(toEPR.getAddress()).getPath(); + + // remove the leading slash + if (path != null && path.length() > 1 && path.startsWith("/")) { + path = path.substring(1); + } + + ConfigurationContext configurationContext = messageContext.getConfigurationContext(); + AxisConfiguration registry = configurationContext.getAxisConfiguration(); + + return registry.getService(path); + + } else { + if(isDebugEnabled){ + log.debug("Attempted to check for Service using null target endpoint URI"); + } + return null; + } + } + + public void initDispatcher() { + init(new HandlerDescription(NAME)); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java new file mode 100755 index 0000000000..3f59ec0130 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java @@ -0,0 +1,210 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Binding; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.model.BindingDefinition; +import org.osoa.sca.Constants; + +/** + * Represents a Celtix binding configuration in an assembly + * + * @version $Rev$ $Date$ + */ +public class WebServiceBindingDefinition extends BindingDefinition { + public static final QName CONVERSATION_ID_REFPARM_QN = new QName(Constants.SCA_NS,"conversationID"); + private Definition definition; + private Port port; + private Service service; + private String uri; + private String namespace; + private String serviceName; + private String portName; + private String bindingName; + private Binding binding; + private boolean spec10Compliant; // hack just to allow any existing WS scdl to still work for now + private URI actualURI; + + /** + * @deprecated pre 1.0 binding.ws spec + */ + @Deprecated + public WebServiceBindingDefinition(Definition definition, Port port, String uri, String portURI, Service service) { + this.definition = definition; + this.port = port; + this.uri = uri; + this.service = service; + } + + public WebServiceBindingDefinition(String ns, Definition definition, String serviceName, String portName, String bindingName, String uri) { + this.namespace = ns; + this.definition = definition; + this.serviceName = serviceName; + this.portName = portName; + this.bindingName = bindingName; + this.uri = uri; + this.spec10Compliant = true; + } + + public Port getWSDLPort() { + if (port == null) { + Service service = getWSDLService(); + if (portName == null) { + Map ports = service.getPorts(); + if (ports.size() != 1) { + throw new IllegalStateException("when portName is null WSDL service must have exactly one WSDL port"); + } + port = (Port)ports.values().iterator().next(); + } else { + port = service.getPort(portName); + } + } + return port; + } + + public Service getWSDLService() { + if (service == null) { + if (definition == null) { + throw new IllegalStateException("WSDL definition is null"); + } + Map services = definition.getServices(); + if (serviceName != null) { + QName serviceQN = new QName(namespace, serviceName); + for (Object o : services.values()) { + Service s = (Service) o; + if (s.getQName().equals(serviceQN)) { + service = s; + break; + } + } + if (service == null) { + throw new IllegalStateException("no service: " + serviceQN); + } + } else { + service = (Service)services.values().iterator().next(); + } + } + return service; + } + + public void setWSDLPort(Port value) { + port = value; + } + + public Definition getWSDLDefinition() { + return definition; + } + + public void setWSDLDefinition(Definition def) { + definition = def; + } + + public String getURI() { + return uri; + } + + public URI getPortURI() { + URI portURI = null; + if (definition != null) { + Port port = getWSDLPort(); + final List wsdlPortExtensions = port.getExtensibilityElements(); + for (final Object extension : wsdlPortExtensions) { + if (extension instanceof SOAPAddress) { + try { + portURI = new URI(((SOAPAddress) extension).getLocationURI()); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + break; + } + } + } + return portURI; + } + + public void setURI(String theUri) { + this.uri = theUri; + } + + public Binding getBinding() { + if (binding == null) { + if (definition == null) { + throw new IllegalStateException("WSDL definition is null"); + } + QName bindingQN = new QName(namespace, bindingName); + this.binding = definition.getBinding(bindingQN); + if (binding == null) { + throw new IllegalStateException("no binding: " + bindingQN); + } + } + return binding; + } + + public String getWSDLNamepace() { + return namespace; + } + + public String getPortName() { + return portName; + } + + public String getServiceName() { + return serviceName; + } + + public String getBindingName() { + return bindingName; + } + + public boolean isSpec10Compliant() { + return spec10Compliant; + } + + public URI getActualURI() { + return actualURI; + } + + public void setActualURI(URI actualURI) { + this.actualURI = actualURI; + } + + public Object clone() { + WebServiceBindingDefinition clone = + new WebServiceBindingDefinition(this.namespace, + this.definition, + this.serviceName, + this.portName, + this.bindingName, + this.uri); + + return clone; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java new file mode 100755 index 0000000000..15b58b4305 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java @@ -0,0 +1,244 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import static org.osoa.sca.Constants.SCA_NS; + +import java.io.IOException; +import java.util.Collection; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.WSDLException; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.loader.LoaderUtil; +import org.apache.tuscany.spi.model.ModelObject; + +import org.osoa.sca.annotations.Constructor; +import org.osoa.sca.annotations.Scope; + +/** + * Parses a WebServiceBindingDefinition entry in an assembly XML file + * + * TODO: TUSCANY-1153 support + * + * @version $Rev$ $Date$ + */ +@Scope("COMPOSITE") +@SuppressWarnings("deprecation") +public class WebServiceBindingLoader extends LoaderExtension { + public static final QName BINDING_WS = new QName(SCA_NS, "binding.ws"); + + private WSDLDefinitionRegistry wsdlDefinitionRegistry; + + @Constructor( { "loaderRegistry", "wsdlDefinitionRegistry" }) + public WebServiceBindingLoader(@Autowire LoaderRegistry loaderRegistry, + @Autowire WSDLDefinitionRegistry wsdlDefinitionRegistry) { + super(loaderRegistry); + this.wsdlDefinitionRegistry = wsdlDefinitionRegistry; + } + + public QName getXMLType() { + return BINDING_WS; + } + + public WebServiceBindingDefinition load(CompositeComponent parent, ModelObject object, XMLStreamReader reader, + DeploymentContext deploymentContext) + throws XMLStreamException, LoaderException { + + String uri = reader.getAttributeValue(null, "uri"); + String wsdlElement = reader.getAttributeValue(null, "wsdlElement"); + String wsdliLocation = reader.getAttributeValue(null, "wsdlLocation"); + + // TODO: keep these old attributes for now for backward compatability + String endpoint = reader.getAttributeValue(null, "endpoint"); + String wsdlLocation = reader.getAttributeValue(null, "location"); + + // TODO: support wsa:endpointreference + + LoaderUtil.skipToEndElement(reader); + + WebServiceBindingDefinition wsBinding; + if (endpoint != null && endpoint.length() > 0) { + // TODO: support these old attributes for now for backward compatability + try { + wsBinding = createBindingOld(uri, endpoint, wsdlLocation, deploymentContext); + } catch (Exception e) { + throw new LoaderException(e); + } + } else { + wsBinding = createWSBinding(wsdlElement, wsdliLocation, uri, deploymentContext); + } + + return wsBinding; + } + + protected WebServiceBindingDefinition createWSBinding(String wsdlElement, String wsdliLocation, String uri, DeploymentContext deploymentContext) throws LoaderException { + String ns = null; + String serviceName = null; + String portName = null; + String bindingName = null; + + if (wsdlElement != null && wsdlElement.length() > 0) { + + ns = getWSDLNamespace(wsdlElement); + + String uriValue = getWSDLElementURIValue(wsdlElement, "wsdl.service"); + if (uriValue != null) { + serviceName = uriValue; + } else { + uriValue = getWSDLElementURIValue(wsdlElement, "wsdl.port"); + if (uriValue != null) { + int i = uriValue.lastIndexOf('/'); + if (i == -1) { + throw new IllegalArgumentException("Missing '/' seperator between service and port in wsdl.port() in wsdlElement attribute"); + } + serviceName = uriValue.substring(0, i); + portName = uriValue.substring(i+1); + } else { + uriValue = getWSDLElementURIValue(wsdlElement, "wsdl.endpoint"); + if (uriValue != null) { + throw new IllegalArgumentException("WSDL 2.0 not supported for '#wsdl.endpoint' in wsdlElement attribute"); + } + uriValue = getWSDLElementURIValue(wsdlElement, "wsdl.binding"); + if (uriValue == null) { + throw new IllegalArgumentException("missing '#wsdl.service' or '#wsdl.port' or '#wsdl.endpoint'or '#wsdl.binding' in wsdlElement attribute"); + } + bindingName = uriValue; + } + } + } + + Definition definition = null; + if (wsdliLocation != null && wsdliLocation.length() > 0) { + try { + definition = wsdlDefinitionRegistry.loadDefinition(wsdliLocation, deploymentContext.getClassLoader()); + } catch (Exception e) { + throw new LoaderException("Exception loading WSDL", e); + } + } else if (ns != null ){ + definition = wsdlDefinitionRegistry.getDefinition(ns); + } + + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(ns, definition, serviceName, portName, bindingName, uri); + + return wsBinding; + } + + protected String getWSDLElementURIValue(String wsdlElement, String type) { + String value = null; + String fullType = "#" + type + "("; + int i = wsdlElement.indexOf(fullType); + if (i > -1) { + int j = wsdlElement.indexOf(')',i); + if (j < 0) { + throw new IllegalArgumentException("missing closing bracket ')' on " + fullType + " in wsdlElement attribute"); + } + value = wsdlElement.substring(i + fullType.length(), j); + } + return value; + } + + protected String getWSDLNamespace(String wsdlElement) { + String ns = null; + if (wsdlElement != null && wsdlElement.length() > 0) { + int i = wsdlElement.indexOf('#'); + if (i < 0) { + throw new IllegalArgumentException("missing '#' namespace delimiter in wsdlElement attribute"); + } + if (i == 0) { + throw new IllegalArgumentException("no namespace in wsdlElement attribute"); + } + ns = wsdlElement.substring(0, i); + } + return ns; + } + + @SuppressWarnings("unchecked") + private WebServiceBindingDefinition createBindingOld(String uri, String endpoint, String wsdlLocation, DeploymentContext deploymentContext) + throws WSDLException, IOException, LoaderException { + // Get the WSDL port namespace and name + if (endpoint != null) { + int h = endpoint.indexOf('#'); + String serviceName; + String portName; + + String namespace = endpoint.substring(0, h); + String fragment = endpoint.substring(h + 1); + if (fragment.startsWith("wsdl.endpoint(") && fragment.endsWith(")")) { + fragment = fragment.substring(14, fragment.length() - 1); + int slash = fragment.indexOf('/'); + if (slash != -1) { + serviceName = fragment.substring(0, slash); + portName = fragment.substring(slash + 1); + } else { + serviceName = null; + portName = fragment; + } + } else { + serviceName = null; + portName = fragment; + } + // FIXME need to find out how to get wsdl and what context to use --- terrible hack attack! + if (null == wsdlLocation) { + throw new Axis2BindingRunTimeException( + "Failed to determine wsdl location on binding. Try specifying 'location' attribute on binding."); + } + Definition definition = + wsdlDefinitionRegistry.loadDefinition(namespace+" "+wsdlLocation, deploymentContext.getClassLoader()); + + Port thePort = null; + Service service = null; + // Find the port with the given name + for (Service serv : (Collection) definition.getServices().values()) { + QName sqn = serv.getQName(); + if (serviceName != null && !serviceName.equals(sqn.getLocalPart())) { + continue; + } + + Port p = serv.getPort(portName); + if (p != null) { + service = serv; + thePort = p; + break; + } + } + if (thePort == null) { + throw new IllegalArgumentException("Cannot find WSDL port " + endpoint); + + } + return new WebServiceBindingDefinition(definition, thePort, uri, endpoint, service); + } + // FIXME: Find the first port? + throw new LoaderException("Web Service endpoint cannot be resolved: " + endpoint); + + } + +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java new file mode 100755 index 0000000000..c0ef46fee3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2.util; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.axis2.deployment.URLBasedAxisConfigurator; +import org.apache.axis2.engine.AxisConfigurator; + +/** + * Helps configure Axis2 from a resource in binding.axis2 instead of Axis2.xml + *

TODO: Review: should there be a single global Axis + * ConfigurationContext + */ +public class TuscanyAxisConfigurator extends URLBasedAxisConfigurator implements AxisConfigurator { + + public TuscanyAxisConfigurator() throws AxisFault { + super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/binding/axis2/engine/config/axis2.xml"), null); + } + + public ConfigurationContext getConfigurationContext() throws AxisFault { + if (configContext == null) + configContext = ConfigurationContextFactory.createConfigurationContext(this); + return configContext; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java new file mode 100755 index 0000000000..c5d3733d01 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java @@ -0,0 +1,491 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2.util; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import javax.wsdl.Binding; +import javax.wsdl.BindingInput; +import javax.wsdl.BindingOperation; +import javax.wsdl.BindingOutput; +import javax.wsdl.Input; +import javax.wsdl.Message; +import javax.wsdl.Operation; +import javax.wsdl.Output; +import javax.wsdl.Part; +import javax.wsdl.extensions.soap.SOAPBinding; +import javax.wsdl.extensions.soap.SOAPHeader; +import javax.wsdl.extensions.soap.SOAPOperation; +import javax.xml.namespace.QName; + +/** + * Metadata for a WSDL operation + */ +@SuppressWarnings({"all"}) +public class WebServiceOperationMetaData implements Serializable { + private static final long serialVersionUID = 2425306250256227724L; + + // WSDL BindingDefinition and BindingOperation + private Binding binding; + private BindingOperation bindingOperation; + // Fields to cache derived metadata + private transient Set inputHeaderParts; + private transient Set outputHeaderParts; + private transient String style; + private transient String use; + private transient String soapAction; + private transient List signature; + private String encoding; + private transient QName rpcOperationName; + + public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation) { + this.binding = binding; + this.bindingOperation = bindingOperation; + } + + public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation, String style, String use, + String encoding, + String soapAction) { + this.binding = binding; + this.bindingOperation = bindingOperation; + this.style = style; + this.use = use; + this.encoding = encoding; + this.soapAction = soapAction; + } + + public Set getInputHeaderParts() { + if (inputHeaderParts == null) { + // Build a set of header parts that we need to exclude + inputHeaderParts = new HashSet(); + BindingInput bindingInput = bindingOperation.getBindingInput(); + + if (bindingInput != null) { + Operation operation = bindingOperation.getOperation(); + javax.wsdl.Message message = operation.getInput().getMessage(); + List elements = bindingInput.getExtensibilityElements(); + for (Iterator i = elements.iterator(); i.hasNext();) { + Object extensibilityElement = i.next(); + Part part = getPartFromSOAPHeader(message, extensibilityElement); + if (part != null) { + inputHeaderParts.add(part); + } + } + } + } + return inputHeaderParts; + } + + public Set getOutputHeaderParts() { + if (outputHeaderParts == null) { + // Build a set of header parts that we need to exclude + outputHeaderParts = new HashSet(); + BindingOutput bindingOutput = bindingOperation.getBindingOutput(); + + if (bindingOutput != null) { + Operation operation = bindingOperation.getOperation(); + javax.wsdl.Message message = operation.getOutput().getMessage(); + List elements = bindingOutput.getExtensibilityElements(); + for (Iterator i = elements.iterator(); i.hasNext();) { + Object extensibilityElement = i.next(); + Part part = getPartFromSOAPHeader(message, extensibilityElement); + if (part != null) { + outputHeaderParts.add(part); + } + } + } + } + return outputHeaderParts; + } + + private Part getPartFromSOAPHeader(Message message, Object extensibilityElement) { + Part part = null; + if (extensibilityElement instanceof SOAPHeader) { + SOAPHeader soapHeader = (SOAPHeader) extensibilityElement; + QName msgName = soapHeader.getMessage(); + if (message.getQName().equals(msgName)) { + part = message.getPart(soapHeader.getPart()); + } + } else if (extensibilityElement instanceof SOAPHeader) { + SOAPHeader soapHeader = (SOAPHeader) extensibilityElement; + QName msgName = soapHeader.getMessage(); + if (message.getQName().equals(msgName)) { + part = message.getPart(soapHeader.getPart()); + } + } + return part; + } + + public String getStyle() { + if (style == null) { + SOAPOperation soapOperation = (SOAPOperation) WebServicePortMetaData + .getExtensibilityElement(bindingOperation.getExtensibilityElements(), + SOAPOperation.class); + if (soapOperation != null) { + style = soapOperation.getStyle(); + } + if (style == null) { + SOAPBinding soapBinding = WebServicePortMetaData + .getExtensibilityElement(binding.getExtensibilityElements(), SOAPBinding.class); + if (soapBinding != null) { + style = soapBinding.getStyle(); + } + } + if (style == null) { + style = "document"; + } + } + return style; + } + + /** + * Returns the SOAP action for the given operation. + */ + public String getSOAPAction() { + if (soapAction == null) { + final List wsdlBindingOperationExtensions = bindingOperation.getExtensibilityElements(); + final SOAPOperation soapOp = + WebServicePortMetaData.getExtensibilityElement(wsdlBindingOperationExtensions, SOAPOperation.class); + if (soapOp != null) { + soapAction = soapOp.getSoapActionURI(); + } + } + return soapAction; + } + + public QName getRPCOperationName() { + if (rpcOperationName == null) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); + String ns = + (soapBody != null) ? soapBody.getNamespaceURI() : binding.getPortType().getQName().getNamespaceURI(); + String name = bindingOperation.getOperation().getName(); + rpcOperationName = new QName(ns, name); + } + return rpcOperationName; + } + + private List getSOAPBodyParts(boolean input) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(input); + if (soapBody != null) { + List parts = soapBody.getParts(); + if (parts != null) { + List names = new ArrayList(); + for (Iterator i = parts.iterator(); i.hasNext();) { + Object part = i.next(); + if (part instanceof String) { + names.add((String) part); + } else if (part instanceof Part) { + names.add(((Part) part).getName()); + } + } + return names; + } else { + return null; + } + } else { + return null; + } + } + + private javax.wsdl.extensions.soap.SOAPBody getSOAPBody(boolean input) { + List elements = null; + if (input) { + BindingInput bindingInput = bindingOperation.getBindingInput(); + if (bindingInput == null) { + return null; + } + elements = bindingInput.getExtensibilityElements(); + } else { + BindingOutput bindingOutput = bindingOperation.getBindingOutput(); + if (bindingOutput == null) { + return null; + } + elements = bindingOutput.getExtensibilityElements(); + } + javax.wsdl.extensions.soap.SOAPBody soapBody = WebServicePortMetaData.getExtensibilityElement(elements, + javax.wsdl.extensions.soap.SOAPBody.class); + return soapBody; + } + + /** + * Returns the use attribute + */ + public String getUse() { + if (use == null) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); + if (soapBody != null) { + use = soapBody.getUse(); + } + if (use == null) { + use = "literal"; + } + } + return use; + } + + @SuppressWarnings("unchecked") + public String getEncoding() { + if (encoding == null) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); + if (soapBody != null) { + List styles = (List) soapBody.getEncodingStyles(); + if (styles != null && !styles.isEmpty()) { + encoding = styles.get(0); + } + } + if (encoding == null) { + encoding = ""; + } + } + return encoding; + } + + public boolean isDocLitWrapped() { + boolean flag = getStyle().equals("document") && getUse().equals("literal"); + if (!flag) { + return false; + } + Message msg = getMessage(true); + if (msg == null) { + return false; + } + List parts = msg.getOrderedParts(null); + if (parts.size() != 1) { + return false; + } + Part part = (Part) parts.get(0); + QName element = part.getElementName(); + if (element == null) { + return false; + } + return element.getLocalPart().equals(bindingOperation.getOperation().getName()); + } + + /* + * public SOAPMediator createMediator(boolean serverMode) throws SOAPException { + * // create a new mediator for each invoke for thread-safety + * boolean rpcStyle = getStyle().equals("rpc"); boolean rpcEncoded = isEncoded(); + * + * SOAPMediator mediator = null; + * + * if (!rpcStyle) { // Document mediator = new SOAPDocumentLiteralMediatorImpl(this, serverMode); + * } else { if (!rpcEncoded) mediator = new + * SOAPRPCLiteralMediatorImpl(this, serverMode); // RPC-literal else mediator = + * new SOAPRPCEncodedMediatorImpl(this, serverMode); // RPC-encoded } + * return mediator; } + */ + + /** + * Get the operation signature from the WSDL operation + */ + public List getOperationSignature() { + if (signature == null) { + signature = new ArrayList(); + + Operation operation = bindingOperation.getOperation(); + if (operation == null) { + return signature; + } + + final Input input = operation.getInput(); + if (input == null) { + return signature; + } + + String sstyle = getStyle(); + + if ("rpc".equals(sstyle)) { + Collection partNames = input.getMessage().getParts().values(); + for (Iterator i = partNames.iterator(); i.hasNext();) { + Part part = (Part) i.next(); + signature.add(part.getName()); + } + } else { + /* + * WS-I Basic Profile 1.1 4.7.6 Operation Signatures Definition: operation signature + * + * The profile defines the "operation signature" to be the fully qualified name of the child element of + * SOAP body of the SOAP input + * message described by an operation in a WSDL binding. + * + * In the case of rpc-literal binding, the operation name is used as a wrapper for the part accessors. + * In the document-literal case, designed so that they meet this requirement. + * + * An endpoint that supports multiple operations must unambiguously identify the operation being + * invoked based on the input message + * that it receives. This is only possible if all the operations specified in the wsdl:binding + * associated with an endpoint have a + * unique operation signature. + * + * R2710 The operations in a wsdl:binding in a DESCRIPTION MUST result in operation signatures that are + * different from one another. + */ + List bodyParts = getSOAPBodyParts(true); + + Collection parts = input.getMessage().getParts().values(); + // Exclude the parts to be transmitted in SOAP header + if (bodyParts == null) { + parts.removeAll(getInputHeaderParts()); + } + for (Iterator i = parts.iterator(); i.hasNext();) { + Part part = (Part) i.next(); + if (bodyParts == null) { + // All parts + QName elementName = part.getElementName(); + if (elementName == null) { + elementName = new QName("", part.getName()); + // TODO: [rfeng] throw new + // ServiceRuntimeException("Message part for + // document style must refer to an XSD element + // using a QName: " + part); + } + signature.add(elementName); + } else { + // "parts" in soap:body + if (bodyParts.contains(part.getName())) { + QName elementName = part.getElementName(); + if (elementName == null) { + elementName = new QName("", part.getName()); + // TODO: [rfeng] throw new + // ServiceRuntimeException("Message part for + // document style must refer to an XSD + // element using a QName: " + part); + } + signature.add(elementName); + } + + } + } + } + } + return signature; + } + + public Message getMessage(boolean isInput) { + Operation operation = bindingOperation.getOperation(); + if (operation == null) { + return null; + } + + if (isInput) { + final Input input = operation.getInput(); + return input == null ? null : input.getMessage(); + } else { + final Output output = operation.getOutput(); + return output == null ? null : output.getMessage(); + } + } + + public Part getInputPart(int index) { + Part part = null; + Message message = getMessage(true); + if (message == null) { + return part; + } + + List parts = message.getOrderedParts(null); + return (Part) parts.get(index); + + } + + public Part getOutputPart(int index) { + Part part = null; + Message message = getMessage(false); + if (message == null) { + return part; + } + + List parts = message.getOrderedParts(null); + return (Part) parts.get(index); + + } + + /** + * Get a list of indexes for each part in the SOAP body + * + * @param isInput + */ + public List getBodyPartIndexes(boolean isInput) { + List indexes = new ArrayList(); + + Message message = getMessage(isInput); + if (message == null) { + return indexes; + } + + List bodyParts = getSOAPBodyParts(isInput); + List parts = message.getOrderedParts(null); + Set headerParts = isInput ? getInputHeaderParts() : getOutputHeaderParts(); + + int index = 0; + for (Iterator i = parts.iterator(); i.hasNext(); index++) { + Part part = (Part) i.next(); + if (headerParts.contains(part)) { + continue; + } + if (bodyParts == null) { + // All parts + indexes.add(index); + } else { + // "parts" in soap:body + if (bodyParts.contains(part.getName())) { + indexes.add(index); + } + } + } + return indexes; + } + + /** + * Get the corresponding index for a part in the SOAP header by element name + * + * @param elementName + * @param isInput + */ + public int getHeaderPartIndex(QName elementName, boolean isInput) { + + Message message = getMessage(isInput); + if (message == null) { + return -1; + } + + List parts = message.getOrderedParts(null); + Set headerParts = isInput ? getInputHeaderParts() : getOutputHeaderParts(); + + int index = 0; + for (Iterator i = parts.iterator(); i.hasNext(); index++) { + Part part = (Part) i.next(); + // Test if the part is in header section + if (headerParts.contains(part) && elementName.equals(part.getElementName())) { + return index; + } + } + return -1; + } + + public BindingOperation getBindingOperation() { + return bindingOperation; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java new file mode 100755 index 0000000000..a8d4f0f581 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java @@ -0,0 +1,377 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2.util; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import javax.wsdl.Binding; +import javax.wsdl.BindingOperation; +import javax.wsdl.Definition; +import javax.wsdl.Operation; +import javax.wsdl.Port; +import javax.wsdl.PortType; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.extensions.soap.SOAPBinding; +import javax.xml.namespace.QName; + +import org.apache.tuscany.idl.wsdl.WSDLServiceContract; + +/** + * Metadata for a WSDL port + * + */ +public class WebServicePortMetaData { + + private Service wsdlService; + private QName wsdlServiceName; + private Port wsdlPort; + private Binding wsdlBinding; + private QName wsdlPortName; + private PortType wsdlPortType; + private QName wsdlPortTypeName; + private String endpoint; + private boolean managed; + private List allOperationMetaData; + private WSDLServiceContract interfaceType; + + /** + * Constructor + * + * @param wsdlDefinition + */ + public WebServicePortMetaData(Definition wsdlDefinition, Port wsdlPort, String endpoint, boolean managed) { + + // Lookup the named port + this.wsdlPort = wsdlPort; + wsdlPortName = new QName(wsdlDefinition.getTargetNamespace(), wsdlPort.getName()); + Collection services = wsdlDefinition.getServices().values(); + for (Object serviceObj : services) { + Service service = (Service) serviceObj; + if (service.getPorts().containsValue(wsdlPort)) { + wsdlService = service; + wsdlServiceName = service.getQName(); + break; + } + } + + // Save the binding + wsdlBinding = wsdlPort.getBinding(); + if (wsdlBinding == null) { + throw new IllegalArgumentException("WSDL binding cannot be found for " + wsdlPortName); + } + + // Save the portType + wsdlPortType = wsdlBinding.getPortType(); + if (wsdlPortType == null) { + throw new IllegalArgumentException("WSDL portType cannot be found for " + wsdlPortName); + } + wsdlPortTypeName = wsdlPortType.getQName(); + + // Save the endpoint + this.endpoint = endpoint; + + // Track if this endpoint is managed or not + this.managed = managed; + } + + /** + * Constructor + * + * @param serviceName + * @param portName + * @param portTypeName + * @param endpoint + */ + public WebServicePortMetaData(QName serviceName, String portName, QName portTypeName, String endpoint) { + wsdlServiceName = serviceName; + wsdlPortName = new QName(serviceName.getNamespaceURI(), portName); + wsdlPortTypeName = portTypeName; + this.endpoint = endpoint; + } + + /** + * @return Returns the wsdlPort. + */ + public javax.wsdl.Port getPort() { + return wsdlPort; + } + + /** + * @return Returns the wsdlService. + */ + public QName getServiceName() { + return wsdlServiceName; + } + + /** + * @return Returns the wsdlService. + */ + public javax.wsdl.Service getService() { + return wsdlService; + } + + /** + * @return Returns the wsdlPortType. + */ + public PortType getPortType() { + return wsdlPortType; + } + + /** + * @return Returns the wsdlPortType. + */ + public QName getPortTypeName() { + return wsdlPortTypeName; + } + + /** + * @return Returns the wsdlBinding. + */ + public Binding getBinding() { + return wsdlBinding; + } + + /** + * @return Returns the wsdlPortName. + */ + public QName getPortName() { + return wsdlPortName; + } + + /** + * Returns the endpoint of a given port. + */ + public String getEndpoint() { + + // Return the specified endpoint + if (endpoint != null) { + return endpoint; + } + + // Find the target endpoint on the port + if (wsdlPort != null) { + final List wsdlPortExtensions = wsdlPort.getExtensibilityElements(); + for (final Object extension : wsdlPortExtensions) { + if (extension instanceof SOAPAddress) { + return ((SOAPAddress) extension).getLocationURI(); + } + } + } + + return null; + } + + /** + * Returns the SOAP binding style. + */ + public String getStyle() { + + // Find the binding style + String style = null; + if (wsdlBinding != null) { + final List wsdlBindingExtensions = wsdlBinding.getExtensibilityElements(); + SOAPBinding soapBinding = getExtensibilityElement(wsdlBindingExtensions, SOAPBinding.class); + if (soapBinding != null) { + style = soapBinding.getStyle(); + } + } + + // Default to document + return (style == null) ? "document" : style; + } + + /** + * Returns the use attribute + */ + public String getUse() { + List list = getAllOperationMetaData(); + return list.get(0).getUse(); + } + + /** + * Returns the encoding attribute + */ + public String getEncoding() { + List list = getAllOperationMetaData(); + return list.get(0).getEncoding(); + } + + /** + * @return Returns true if this is a managed web service. + */ + public boolean isManaged() { + return managed; + } + + /** + * Returns the first extensibility element of the given type. + * + * @param elements + * @param type + */ + public static T getExtensibilityElement(List elements, Class type) { + for (Object element : elements) { + if (type.isInstance(element)) { + return type.cast(element); + } + } + return null; + } + + /** + * Returns the extensibility elements of the given type. + * + * @param elements + * @param type + * @return List + */ + public static List getExtensibilityElements(List elements, Class type) { + List result = new ArrayList(); + for (Object element : elements) { + if (type.isInstance(element)) { + result.add(type.cast(element)); + } + } + return result; + } + + /** + * Get the operation signature from the SOAP Body + * + * @return A list of QNames + */ + // public static List getOperationSignature(javax.xml.soap.SOAPBody body) { + // List signature = new ArrayList(); + // for (Iterator i = body.getChildElements(); i.hasNext();) { + // Object child = i.next(); + // if (child instanceof SOAPBodyElement) { + // Name name = ((SOAPBodyElement) child).getElementName(); + // QName qname = new QName(name.getURI(), name.getLocalName(), name.getPrefix()); + // signature.add(qname); + // } + // } + // return signature; + // } + // public static List getRPCOperationSignature(javax.xml.soap.SOAPBody body) { + // List signature = new ArrayList(); + // for (Iterator i = body.getChildElements(); i.hasNext();) { + // Object child = i.next(); + // if (child instanceof SOAPBodyElement) { + // SOAPBodyElement op = ((SOAPBodyElement) child); + // for (Iterator j = op.getChildElements(); j.hasNext();) { + // Object part = i.next(); + // if (part instanceof SOAPElement) { + // SOAPElement p = (SOAPElement) part; + // signature.add(p.getLocalName()); + // } + // } + // } + // } + // return signature; + // } + // public WebServiceOperationMetaData getOperationMetaData(javax.xml.soap.SOAPBody body) { + // List s1 = getOperationSignature(body); + // // List rpcParts = getRPCOperationSignature(body); + // for (Iterator it = getAllOperationMetaData().iterator(); it.hasNext();) { + // WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) it.next(); + // + // String style = descriptor.getStyle(); + // + // if (style.equals("document")) { + // List s2 = descriptor.getOperationSignature(); + // if (s1.equals(s2)) + // return descriptor; + // } else { + // QName op1 = (QName) s1.get(0); + // QName op2 = descriptor.getRPCOperationName(); + // if (op1.equals(op2)) { + // /* + // * // FIXME: [rfeng] We don't support method overloading + // * List partNames = getOperationSignature(binding, + // * bindingOperation); if (rpcParts.equals(partNames)) + // */ + // return descriptor; + // } + // } + // } + // return null; + // } + public List getAllOperationMetaData() { + if (allOperationMetaData == null) { + allOperationMetaData = new ArrayList(); + for (Iterator it = wsdlBinding.getBindingOperations().iterator(); it.hasNext();) { + final BindingOperation bindingOperation = (BindingOperation) it.next(); + if (bindingOperation.getOperation() != null) { + allOperationMetaData.add(new WebServiceOperationMetaData(wsdlBinding, bindingOperation)); + } + } + } + return allOperationMetaData; + } + + public WebServiceOperationMetaData getOperationMetaData(String operationName) { + StringBuilder sb = new StringBuilder(operationName); + sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); + String capatalizedOpName = sb.toString(); + + for (WebServiceOperationMetaData webServiceOperationMetaData : getAllOperationMetaData()) { + WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) webServiceOperationMetaData; + String opName = descriptor.getBindingOperation().getOperation().getName(); + + if (opName.equals(operationName) || opName.equals(capatalizedOpName)) { + return descriptor; + } + } + return null; + } + + /** + * Returns the WSDL service contract + * + * @return WSDLServiceContract + */ + public WSDLServiceContract getInterfaceType() { + return interfaceType; + } + + /** + * Get the WSDL operation name for a Java method name + */ + public String getWSDLOperationName(String methodName) { + StringBuilder sb = new StringBuilder(methodName); + sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); + String capatalizedOpName = sb.toString(); + for (Object o : wsdlPortType.getOperations()) { + Operation operation = (Operation) o; + String wsdlOpName = operation.getName(); + if (wsdlOpName.equals(methodName)) { + return wsdlOpName; + } + if (wsdlOpName.equals(capatalizedOpName)) { + return wsdlOpName; + } + } + return null; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/binding.axis2.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/binding.axis2.scdl new file mode 100644 index 0000000000..ee1b8d9e81 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/binding.axis2.scdl @@ -0,0 +1,48 @@ + + + + + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + 0.1-integration-incubating-SNAPSHOT + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..fd5c2f5baa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,49 @@ + + + + + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + 0.1-integration-incubating-SNAPSHOT + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/extension.composite new file mode 100644 index 0000000000..10306d8968 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/extension.composite @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml new file mode 100755 index 0000000000..e4f6d699f9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml @@ -0,0 +1,306 @@ + + + + + + + false + false + false + false + + + + + + 30 + + + + true + + + + + + false + + admin + axis2 + + + + + + + + + + + + + + false + + + + + + + true + + + false + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6060 + + + + + + + + + + + + + + + + + + + + + + + + 6060 + + + + + + + + + + + + + HTTP/1.1 + chunked + + + HTTP/1.1 + chunked + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java new file mode 100644 index 0000000000..4cb40b0a23 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java @@ -0,0 +1,229 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.replay; + +import java.net.URI; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.tuscany.spi.component.Component; +import org.apache.tuscany.spi.component.CompositeComponent; + +/** + * Tests for the WebServicebindingLoader class + */ +@SuppressWarnings("deprecation") +public class Axis2BindingBuilderTestCase extends TestCase { + + private CompositeComponent parent; + + private static final String NAME = "MyService"; + private static final URI COMPOSITE_NAME = URI.create("MyComposite"); + private static final URI COMPOSITE_NAME2 = URI.create("MyComposite2"); + private static final String BASE_URI = "http://localhost/services"; + + public void testDefaultURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(null, null, null, null, null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/MyComposite/MyService", uri.toString()); + } + + public void testDefaultURIMultiServices() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(null, null, null, null, null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME2, NAME, parent); + assertEquals("http://localhost/services/MyComposite2/MyService", uri.toString()); + } + + public void testExplicitURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(null, null, null, null, null, "http://foo/bar"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://foo/bar", uri.toString()); + } + + public void testExplicitWSDL() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("http://my/wsdl/uri"), "myService", "myPort", null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://my/wsdl/uri", uri.toString()); + } + + public void testExplicitWSDLExplicitURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("http://my/wsdl/uri"), "myService", "myPort", null, "foo"); + try { + builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + fail(); + } catch (IllegalArgumentException e) { + // expected + } + } + + public void testExplicitWSDLBindingExplicitURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDLBinding("http://my/wsdl/uri"), null, null, "myBinding", "http://my/uri"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + + // explicit URI should be used as the WSDL binding is used not the wsdl service/port + assertEquals("http://my/uri", uri.toString()); + } + + public void testExplicitWSDLBindingExplicitRelativeURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDLBinding("http://my/wsdl/uri"), null, null, "myBinding", "x/y"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/MyComposite/x/y", uri.toString()); + } + + public void testExplicitWSDLBindingExplicitRelativeURIWithDot() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDLBinding("http://my/wsdl/uri"), null, null, "myBinding", "x/./y"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/MyComposite/x/y", uri.toString()); + } + + public void testExplicitWSDLBindingExplicitRelativeURIWithDots() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDLBinding("http://my/wsdl/uri"), null, null, "myBinding", "../x/y"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/x/y", uri.toString()); + } + + public void testExplicitRelativeWSDL() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"), "myService", "myPort", null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/MyComposite/MyService/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLMultiServices() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"), "myService", "myPort", null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME2, NAME, parent); + assertEquals("http://localhost/services/MyComposite2/MyService/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLWithDots() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("../foo/bar"), "myService", "myPort", null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/MyComposite/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLWithDotsMultiService() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("../foo/bar"), "myService", "myPort", null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME2, NAME, parent); + assertEquals("http://localhost/services/MyComposite2/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLExplicitURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"), "myService", "myPort", null, "http://my/wsdl/uri"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://my/wsdl/uri/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLWithDotsExplicitURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("../foo/bar"), "myService", "myPort", null, "http://my/wsdl/uri"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://my/wsdl/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLExplicitRelativeURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"), "myService", "myPort", null, "x/y"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/MyComposite/x/y/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLExplicitRelativeURIWithDots() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"), "myService", "myPort", null, "../x/y"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/x/y/foo/bar", uri.toString()); + } + + protected Definition createMockWSDL(String endpoint) { + Definition mockDef = createMock(Definition.class); + + Service wsdlService = createMock(Service.class); + expect(wsdlService.getQName()).andReturn(new QName("myNS", "myService")); + + Port wsdlPort = createMock(Port.class); + List ees = new ArrayList(); + SOAPAddress sa = createMock(SOAPAddress.class); + expect(sa.getLocationURI()).andReturn(endpoint); + ees.add(sa); + expect(wsdlPort.getExtensibilityElements()).andReturn(ees); + + expect(wsdlService.getPort("myPort")).andReturn(wsdlPort); + + Map services = new HashMap(); + services.put("myService", wsdlService); + expect(mockDef.getServices()).andReturn(services); + + replay(mockDef); + replay(wsdlService); + replay(wsdlPort); + replay(sa); + return mockDef; + } + protected Definition createMockWSDLBinding(String endpoint) { + Definition mockDef = createMock(Definition.class); + replay(mockDef); + return mockDef; + } + + protected void setUp() { + parent = createMock(CompositeComponent.class); + Component comp1 = createMock(Component.class); + Component comp2 = createMock(Component.class); + Collection wires1 = new ArrayList(); + wires1.add("dummy1"); + Collection wires2 = new ArrayList(); + wires2.add("dummy1"); + wires2.add("dummy2"); + expect(comp1.getInboundWires()).andReturn(wires1); + expect(comp2.getInboundWires()).andReturn(wires2); + expect(parent.getChild(COMPOSITE_NAME.toString())).andReturn(comp1); + expect(parent.getChild(COMPOSITE_NAME2.toString())).andReturn(comp2); + replay(comp1); + replay(comp2); + replay(parent); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java new file mode 100755 index 0000000000..e8f1f29034 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION; + +import java.lang.reflect.Type; +import java.net.URL; +import java.util.HashMap; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.tuscany.idl.wsdl.WSDLServiceContract; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.idl.java.JavaServiceContract; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.TargetInvoker; +import org.apache.tuscany.spi.wire.WireService; +import org.easymock.EasyMock; +import org.xml.sax.InputSource; + +public class Axis2ReferenceTestCase extends TestCase { + + public void testInvokeService() throws Exception { + Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName"); + ServiceContract contract = new JavaServiceContract(); + Operation operation = new Operation("sayHi", null, null, null, false, null, NO_CONVERSATION); + TargetInvoker targetInvoker = axis2Reference.createTargetInvoker(contract, operation); + assertNotNull(targetInvoker); + assertFalse(targetInvoker instanceof Axis2AsyncTargetInvoker); + } + + public void testAsyncTargetInvoker() throws Exception { + Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName"); + //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class + InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class); + JavaServiceContract contract = new JavaServiceContract(Greeter.class); + contract.setCallbackName(""); + contract.setCallbackClass(GreetingCallback.class); + Operation callbackOp = + new Operation("sayHiCallback", null, null, null, true, null, NO_CONVERSATION); + HashMap> callbackOps = new HashMap>(); + callbackOps.put("sayHiCallback", callbackOp); + contract.setCallbackOperations(callbackOps); + EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes(); + EasyMock.replay(inboundWire); + + axis2Reference.setInboundWire(inboundWire); + Operation operation = new Operation("sayHi", null, null, null, true, null, NO_CONVERSATION); + TargetInvoker asyncTargetInvoker = axis2Reference.createTargetInvoker(contract, operation); + assertNotNull(asyncTargetInvoker); + assertTrue(asyncTargetInvoker instanceof Axis2AsyncTargetInvoker); + } + + @SuppressWarnings("unchecked") + private Axis2ReferenceBinding createAxis2Reference(String webAppName, String serviceName) throws Exception { + //Create WebServiceBindingDefinition + String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl"; + URL url = getClass().getResource(wsdlLocation); + assertNotNull("Could not find wsdl " + url.toString(), url); + + WSDLFactory factory = WSDLFactory.newInstance(); + WSDLReader reader = factory.newWSDLReader(); + reader.setFeature("javax.wsdl.verbose", false); + InputSource input = new InputSource(url.openStream()); + Definition wsdlDef = reader.readWSDL(url.toString(), input); + Service wsdlService = wsdlDef.getService(new QName("http://objectweb.org/hello_world_soap_http", + "SOAPService")); + Port port = wsdlService.getPort("SoapPort"); + WebServiceBindingDefinition wsBinding = + new WebServiceBindingDefinition(wsdlDef, port, "uri", "portURI", wsdlService); + //Create a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance. + WireService wireService = EasyMock.createNiceMock(WireService.class); + EasyMock.replay(wireService); + CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class); + // TODO figure out what to do with the service contract + ServiceContract contract = new WSDLServiceContract(); + contract.setInterfaceClass(Greeter.class); + return new Axis2ReferenceBinding(serviceName, + parent, + wsBinding, + contract, + null, + null); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java new file mode 100755 index 0000000000..03340275b3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java @@ -0,0 +1,153 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.lang.reflect.Method; +import java.lang.reflect.Type; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import javax.servlet.Servlet; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; + +import org.xml.sax.InputSource; + +import org.apache.tuscany.spi.host.ServletHost; +import org.apache.tuscany.spi.idl.java.JavaServiceContract; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.OutboundInvocationChain; +import org.apache.tuscany.spi.wire.OutboundWire; +import org.apache.tuscany.spi.wire.WireService; + +import junit.framework.TestCase; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator; +import org.apache.tuscany.core.component.WorkContextImpl; +import org.easymock.EasyMock; + +public class Axis2ServiceTestCase extends TestCase { + + public void testInvokeService() throws Exception { + TestServletHost tomcatHost = new TestServletHost(); + Axis2ServiceBinding axis2Service = createAxis2Service("testServiceName", tomcatHost, false); + axis2Service.start(); + + if (true) return; + Servlet servlet = tomcatHost.getMapping("testWebAppName/serviceBindings/testServiceName"); + assertNotNull(servlet); + + //Create mocked HttpRequest and HttpResponse object to test the Axis2Servlet + //To be done: + + } + + public void testAsyncMessageReceiver() throws Exception { + + TestServletHost tomcatHost = new TestServletHost(); + Axis2ServiceBinding axis2Service = createAxis2Service("testServiceName", tomcatHost, true); + axis2Service.start(); + } + + @SuppressWarnings("unchecked") + private Axis2ServiceBinding createAxis2Service(String serviceName, ServletHost tomcatHost, boolean callback) + throws Exception { + //Create WebServiceBindingDefinition + String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl"; + URL url = getClass().getResource(wsdlLocation); + assertNotNull("Could not find wsdl " + url.toString(), url); + + WSDLFactory factory = WSDLFactory.newInstance(); + WSDLReader reader = factory.newWSDLReader(); + reader.setFeature("javax.wsdl.verbose", false); + InputSource input = new InputSource(url.openStream()); + Definition wsdlDef = reader.readWSDL(url.toString(), input); + Service wsdlService = wsdlDef.getService(new QName("http://objectweb.org/hello_world_soap_http", + "SOAPService")); + Port port = wsdlService.getPort("SoapPort"); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(wsdlDef, port, "uri", "portURI", wsdlService); + + //Create a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance. + WireService wireService = EasyMock.createNiceMock(WireService.class); + wireService.createProxy(EasyMock.isA(Class.class), EasyMock.isA(InboundWire.class)); + EasyMock.expectLastCall().andReturn(null); + EasyMock.replay(wireService); + + //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class + InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class); + JavaServiceContract contract = new JavaServiceContract(Greeter.class); + Map> opMap = new HashMap>(); + for (Method m : Greeter.class.getMethods()) { + opMap.put(m.getName(), new Operation(m.getName(), null, null, null)); + } + contract.setOperations(opMap); + EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes(); + if (callback) { + contract.setCallbackName(""); + } + EasyMock.replay(inboundWire); + + OutboundWire outboundWire = EasyMock.createNiceMock(OutboundWire.class); + Map, OutboundInvocationChain> map = new HashMap, OutboundInvocationChain>(); + EasyMock.expect(outboundWire.getInvocationChains()).andReturn(map).once(); + EasyMock.replay(outboundWire); + + TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator(); + ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext(); + Axis2ServiceBinding axis2Service = + new Axis2ServiceBinding(serviceName, + contract, + null, + null, + wsBinding, + tomcatHost, + configurationContext, new WorkContextImpl()); + axis2Service.setInboundWire(inboundWire); + axis2Service.setOutboundWire(outboundWire); + + return axis2Service; + } + + protected class TestServletHost implements ServletHost { + private Map mappings = new HashMap(); + + public void registerMapping(String mapping, Servlet servlet) { + mappings.put(mapping, servlet); + } + + public Servlet unregisterMapping(String mapping) { + return mappings.remove(mapping); + } + + public Servlet getMapping(String mapping) { + return mappings.get(mapping); + } + + public boolean isMappingRegistered(String mapping) { + return mappings.containsKey(mapping); + } + + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java new file mode 100755 index 0000000000..39fccdadd3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +public interface Greeter { + + String sayHi(); + + String greetMe(String requestType); + + void greetMeOneWay(String requestType); + + void greetMeWithCallback(String requestType); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/GreetingCallback.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/GreetingCallback.java new file mode 100644 index 0000000000..4c3b3304ea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/GreetingCallback.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +public interface GreetingCallback { + + void greetMeCallback(String greetMeResponse); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/WebServicebindingLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/WebServicebindingLoaderTestCase.java new file mode 100644 index 0000000000..75a848b88e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/WebServicebindingLoaderTestCase.java @@ -0,0 +1,187 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.replay; + +import java.util.HashMap; +import java.util.Map; + +import javax.wsdl.Binding; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry; +import org.easymock.EasyMock; + +/** + * Tests for the WebServicebindingLoader class + */ +@SuppressWarnings("deprecation") +public class WebServicebindingLoaderTestCase extends TestCase { + + public void testCreateWSBinding() throws Exception { + WSDLDefinitionRegistry wsdlReg = createMock(WSDLDefinitionRegistry.class); + Definition mockDef = createMock(Definition.class); + expect(wsdlReg.getDefinition("myNS")).andReturn(mockDef); + replay(wsdlReg); + + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, wsdlReg); + + WebServiceBindingDefinition binding = loader.createWSBinding("myNS#wsdl.service(myService)", null, null, null); + assertEquals(mockDef, binding.getWSDLDefinition()); + + EasyMock.verify(wsdlReg); + } + + public void testCreateWSBindingWsdlService() throws Exception { + WSDLDefinitionRegistry wsdlReg = createMock(WSDLDefinitionRegistry.class); + Definition mockDef = createMock(Definition.class); + + Service wsdlService = createMock(Service.class); + expect(wsdlService.getQName()).andReturn(new QName("myNS", "myService")); + + Map services = new HashMap(); + services.put("myService", wsdlService); + expect(mockDef.getServices()).andReturn(services); + + expect(wsdlReg.getDefinition("myNS")).andReturn(mockDef); + + replay(wsdlService); + replay(wsdlReg); + replay(mockDef); + + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, wsdlReg); + + WebServiceBindingDefinition binding = loader.createWSBinding("myNS#wsdl.service(myService)", null, null, null); + assertEquals(mockDef, binding.getWSDLDefinition()); + + assertEquals(wsdlService, binding.getWSDLService()); + + EasyMock.verify(wsdlService); + EasyMock.verify(wsdlReg); + EasyMock.verify(mockDef); + } + + public void testCreateWSBindingWsdlPort() throws Exception { + WSDLDefinitionRegistry wsdlReg = createMock(WSDLDefinitionRegistry.class); + Definition mockDef = createMock(Definition.class); + + Service wsdlService = createMock(Service.class); + expect(wsdlService.getQName()).andReturn(new QName("myNS", "myService")); + + Port wsdlPort = createMock(Port.class); + expect(wsdlService.getPort("myPort")).andReturn(wsdlPort); + + Map services = new HashMap(); + services.put("myService", wsdlService); + expect(mockDef.getServices()).andReturn(services); + + expect(wsdlReg.getDefinition("myNS")).andReturn(mockDef); + + replay(wsdlService); + replay(wsdlReg); + replay(mockDef); + + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, wsdlReg); + + WebServiceBindingDefinition binding = loader.createWSBinding("myNS#wsdl.port(myService/myPort)", null, null, null); + assertEquals(mockDef, binding.getWSDLDefinition()); + + assertEquals(wsdlPort, binding.getWSDLPort()); + + EasyMock.verify(wsdlService); + EasyMock.verify(wsdlReg); + EasyMock.verify(mockDef); + } + + public void testCreateWSBindingWsdlBinding() throws Exception { + WSDLDefinitionRegistry wsdlReg = createMock(WSDLDefinitionRegistry.class); + Definition mockDef = createMock(Definition.class); + + Binding wsdlBinding = createMock(Binding.class); + QName bindingQN = new QName("myNS", "myBinding"); + expect(mockDef.getBinding(bindingQN)).andReturn(wsdlBinding); + + expect(wsdlReg.getDefinition("myNS")).andReturn(mockDef); + + replay(wsdlReg); + replay(mockDef); + + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, wsdlReg); + + WebServiceBindingDefinition binding = loader.createWSBinding("myNS#wsdl.binding(myBinding)", null, null, null); + assertEquals(mockDef, binding.getWSDLDefinition()); + + assertEquals(wsdlBinding, binding.getBinding()); + + EasyMock.verify(wsdlReg); + EasyMock.verify(mockDef); + } + + public void testGetWSDLElementURIValue() throws Exception { + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, null); + assertEquals("myValue", loader.getWSDLElementURIValue("myNs#wsdl.foo(myValue)", "wsdl.foo")); + assertNull(loader.getWSDLElementURIValue("myNs#wsdl.XXX(myValue)", "wsdl.foo")); + } + + public void testBadGetWSDLElementURIValue() throws Exception { + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, null); + try { + loader.getWSDLElementURIValue("myNs#wsdl.foo(myValue", "wsdl.foo"); + fail(); + } catch (IllegalArgumentException e) { + // expected + } + } + + public void testGetWSDLNamespace() throws Exception { + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, null); + assertEquals("myNS", loader.getWSDLNamespace("myNS#bla")); + } + + public void testNullGetWSDLNamespace() throws Exception { + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, null); + assertNull(loader.getWSDLNamespace("")); + assertNull(loader.getWSDLNamespace(null)); + } + + public void testBadGetWSDLNamespace() throws Exception { + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, null); + try { + loader.getWSDLNamespace("bla"); + fail(); + } catch (IllegalArgumentException e) { + // expected + } + try { + loader.getWSDLNamespace("#bla"); + fail(); + } catch (IllegalArgumentException e) { + // expected + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl new file mode 100755 index 0000000000..d0958f282e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/.ruleset new file mode 100644 index 0000000000..e615e93a4b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/.ruleset @@ -0,0 +1,172 @@ + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/LICENSE.txt new file mode 100755 index 0000000000..d645695673 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/pom.xml new file mode 100755 index 0000000000..09dae91e74 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/pom.xml @@ -0,0 +1,78 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + databinding-axiom + Apache Tuscany Data Binding for Axiom + Tuscany Axiom Data Binding + + + + + org.apache.tuscany.sca.kernel + tuscany-spi + + + + org.apache.ws.commons.axiom + axiom-api + + + xerces + xercesImpl + + + + + + xerces + xercesImpl + + + + org.apache.ws.commons.axiom + axiom-impl + runtime + + + + junit + junit + + + + org.codehaus.woodstox + wstx-asl + + + + commons-logging + commons-logging + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomDataBinding.java new file mode 100644 index 0000000000..68232cf2b8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomDataBinding.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.databinding.axiom; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.ExceptionHandler; +import org.apache.tuscany.spi.databinding.WrapperHandler; +import org.apache.tuscany.spi.databinding.extension.DataBindingExtension; +import org.osoa.sca.annotations.Service; + +/** + * DataBinding for AXIOM + */ +@Service(DataBinding.class) +public class AxiomDataBinding extends DataBindingExtension { + + public static final String NAME = OMElement.class.getName(); + public static final String[] ALIASES = new String[] {"axiom"}; + + public AxiomDataBinding() { + super(NAME, ALIASES, OMElement.class); + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.DataBindingExtension#getWrapperHandler() + */ + @Override + public WrapperHandler getWrapperHandler() { + return new OMElementWrapperHandler(); + } + + public Object copy(Object source) { + if ( OMElement.class.isAssignableFrom(source.getClass()) ) { + try { + OMElement sourceElement = (OMElement)source; + return sourceElement.cloneOMElement(); + } catch ( Exception e ) { + throw new IllegalArgumentException(e); + } + } + return super.copy(source); + } + + @Override + public ExceptionHandler getExceptionHandler() { + return new AxiomExceptionHandler(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandler.java new file mode 100644 index 0000000000..64fd0221ff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandler.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.databinding.axiom; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.databinding.ExceptionHandler; +import org.apache.tuscany.spi.idl.ServiceFaultException; +import org.apache.tuscany.spi.idl.XMLType; +import org.apache.tuscany.spi.model.DataType; + +/** + * AXIOM implementation of ExceptionHandler + * + * @version $Rev$ $Date$ + */ +public class AxiomExceptionHandler implements ExceptionHandler { + + public Exception createException(DataType exceptionType, String message, Object faultInfo, Throwable cause) { + return new ServiceFaultException(message, (OMElement)faultInfo, cause); + } + + public Object getFaultInfo(Exception exception) { + if (exception == null) { + return null; + } + ServiceFaultException faultException = (ServiceFaultException)exception; + return faultException.getFaultInfo(); + + } + + public DataType getFaultType(DataType exceptionType) { + if (ServiceFaultException.class == exceptionType.getPhysical()) { + XMLType type = XMLType.UNKNOWN; + if(exceptionType.getLogical() instanceof XMLType) { + type = (XMLType) exceptionType.getLogical(); + } + DataType faultType = new DataType(AxiomDataBinding.NAME, OMElement.class, type); + return faultType; + } else { + return null; + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomHelper.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomHelper.java new file mode 100644 index 0000000000..b5fb40fa86 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomHelper.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.databinding.axiom; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.idl.XMLType; +import org.apache.tuscany.spi.model.DataType; + +/** + * Helper for AXIOM + * + * @version $Rev$ $Date$ + */ +public class AxiomHelper { + + private AxiomHelper() { + } + + /** + * @param context + * @param element + */ + public static void adjustElementName(TransformationContext context, OMElement element) { + if (context != null) { + DataType dataType = context.getTargetDataType(); + Object logical = dataType == null ? null : dataType.getLogical(); + if (!(logical instanceof XMLType)) { + return; + } + XMLType xmlType = (XMLType)logical; + if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) { + // TODO: Throw expection or switch to the new Element + OMFactory factory = OMAbstractFactory.getOMFactory(); + QName name = xmlType.getElementName(); + OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix()); + element.setNamespace(namespace); + element.setLocalName(name.getLocalPart()); + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2Object.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2Object.java new file mode 100644 index 0000000000..91b1f4da90 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2Object.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.SimpleType2JavaTransformer; +import org.osoa.sca.annotations.Service; + +/** + * Transformer to convert data from a simple java bject to OMElement + */ +@Service(Transformer.class) +public class OMElement2Object extends SimpleType2JavaTransformer { + + @Override + protected String getText(OMElement source) { + return source.getText(); + } + + public Class getSourceType() { + return OMElement.class; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2String.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2String.java new file mode 100755 index 0000000000..52be08537d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2String.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import java.io.StringWriter; + +import javax.xml.stream.XMLStreamException; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; + +/** + * Transformer to convert data from an OMElement to XML String + */ +@Service(Transformer.class) +public class OMElement2String extends TransformerExtension implements PullTransformer { + // private XmlOptions options; + + public String transform(OMElement source, TransformationContext context) { + try { + StringWriter writer = new StringWriter(); + source.serialize(writer); + return writer.toString(); + } catch (XMLStreamException e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return OMElement.class; + } + + public Class getTargetType() { + return String.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2XMLStreamReader.java new file mode 100755 index 0000000000..343408a027 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2XMLStreamReader.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import javax.xml.stream.XMLStreamReader; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; + +@Service(Transformer.class) +public class OMElement2XMLStreamReader extends TransformerExtension implements PullTransformer { + // private XmlOptions options; + + public XMLStreamReader transform(OMElement source, TransformationContext context) { + return source.getXMLStreamReader(); + } + + public Class getSourceType() { + return OMElement.class; + } + + public Class getTargetType() { + return XMLStreamReader.class; + } + + public int getWeight() { + return 10; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java new file mode 100644 index 0000000000..4afc067516 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.databinding.axiom; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.WrapperHandler; +import org.apache.tuscany.spi.idl.ElementInfo; + +/** + * OMElement wrapper handler implementation + */ +public class OMElementWrapperHandler implements WrapperHandler { + + private OMFactory factory; + + public OMElementWrapperHandler() { + super(); + this.factory = OMAbstractFactory.getOMFactory(); + } + + public OMElement create(ElementInfo element, TransformationContext context) { + OMElement wrapper = factory.createOMElement(element.getQName(), null); + return wrapper; + } + + public void setChild(OMElement wrapper, int i, ElementInfo childElement, Object value) { + OMElement element = (OMElement)value; + QName elementName = childElement.getQName(); + OMNamespace namespace = factory.createOMNamespace(elementName.getNamespaceURI(), elementName.getPrefix()); + element.setNamespace(namespace); + element.setLocalName(childElement.getQName().getLocalPart()); + wrapper.addChild((OMElement)value); + } + + public List getChildren(OMElement wrapper) { + List elements = new ArrayList(); + for (Iterator i = wrapper.getChildElements(); i.hasNext();) { + elements.add(i.next()); + } + return elements; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/Object2OMElement.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/Object2OMElement.java new file mode 100644 index 0000000000..8b226319ae --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/Object2OMElement.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.Java2SimpleTypeTransformer; +import org.osoa.sca.annotations.Service; + +/** + * Transformer to convert data from an simple OMElement to Java Object + */ +@Service(Transformer.class) +public class Object2OMElement extends Java2SimpleTypeTransformer { + + private OMFactory factory; + + public Object2OMElement() { + super(); + factory = OMAbstractFactory.getOMFactory(); + } + + protected OMElement createElement(QName element, String text, TransformationContext context) { + OMElement omElement = factory.createOMElement(element, null); + factory.createOMText(omElement, text); + return omElement; + } + + @Override + public Class getTargetType() { + return OMElement.class; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java new file mode 100755 index 0000000000..eb0869dfd7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import java.io.ByteArrayInputStream; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; + +@Service(Transformer.class) +public class String2OMElement extends TransformerExtension implements + PullTransformer { + + @SuppressWarnings("unchecked") + public OMElement transform(String source, TransformationContext context) { + try { + StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(source.getBytes())); + OMElement element = builder.getDocumentElement(); + AxiomHelper.adjustElementName(context, element); + return element; + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getTargetType() { + return OMElement.class; + } + + public Class getSourceType() { + return String.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/XMLStreamReader2OMElement.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/XMLStreamReader2OMElement.java new file mode 100755 index 0000000000..e882d0f086 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/XMLStreamReader2OMElement.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import javax.xml.stream.XMLStreamReader; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; + +@Service(Transformer.class) +public class XMLStreamReader2OMElement extends TransformerExtension implements + PullTransformer { + + public XMLStreamReader2OMElement() { + super(); + } + + public OMElement transform(XMLStreamReader source, TransformationContext context) { + try { + StAXOMBuilder builder = new StAXOMBuilder(source); + OMElement element = builder.getDocumentElement(); + AxiomHelper.adjustElementName(context, element); + return element; + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getTargetType() { + return OMElement.class; + } + + public Class getSourceType() { + return XMLStreamReader.class; + } + + public int getWeight() { + return 10; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/databinding.axiom.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/databinding.axiom.scdl new file mode 100644 index 0000000000..34ff82ddd5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/databinding.axiom.scdl @@ -0,0 +1,57 @@ + + + + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + 0.1-integration-incubating-SNAPSHOT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..ac92746c8d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,56 @@ + + + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + 0.1-integration-incubating-SNAPSHOT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/extension.composite new file mode 100644 index 0000000000..09cab77b5a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/extension.composite @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandlerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandlerTestCase.java new file mode 100644 index 0000000000..2e7eccf620 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandlerTestCase.java @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.databinding.axiom; + +import java.io.StringReader; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamReader; + +import junit.framework.TestCase; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; +import org.apache.tuscany.spi.idl.ServiceFaultException; +import org.apache.tuscany.spi.idl.XMLType; +import org.apache.tuscany.spi.model.DataType; + +/** + * Test case for SDOExceptionHandler + */ +public class AxiomExceptionHandlerTestCase extends TestCase { + private static final String IPO_XML = + "" + "" + + " " + + " Helen Zoe" + + " 47 Eden Street" + + " Cambridge" + + " CB1 1JR" + + " " + + " " + + " Robert Smith" + + " 8 Oak Avenue" + + " Old Town" + + " PA" + + " 95819" + + " " + + " " + + " " + + " Lapis necklace" + + " 1" + + " 99.95" + + " Want this for the holidays" + + " 1999-12-05" + + " " + + " " + + ""; + + private AxiomExceptionHandler handler; + private OMElement faultElement; + + /** + * @see junit.framework.TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + this.handler = new AxiomExceptionHandler(); + XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML)); + StAXOMBuilder builder = new StAXOMBuilder(reader); + faultElement = builder.getDocumentElement(); + } + + public void testGetFaultType() { + DataType dataType = handler.getFaultType(new DataType(ServiceFaultException.class, null)); + assertEquals(OMElement.class, dataType.getPhysical()); + assertEquals(XMLType.UNKNOWN, dataType.getLogical()); + assertEquals(AxiomDataBinding.NAME, dataType.getDataBinding()); + dataType = handler.getFaultType(new DataType(Exception.class, null)); + assertNull(dataType); + } + + public void testCreate() { + + Exception ex = handler.createException(null, "Order", faultElement, null); + assertTrue(ex instanceof ServiceFaultException); + ServiceFaultException exception = (ServiceFaultException)ex; + assertEquals("Order", exception.getMessage()); + assertSame(faultElement, exception.getFaultInfo()); + } + + public void testGetFaultInfo() { + ServiceFaultException exception = new ServiceFaultException("Order", faultElement, null); + Object faultInfo = handler.getFaultInfo(exception); + assertSame(faultElement, faultInfo); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/OMElementTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/OMElementTestCase.java new file mode 100755 index 0000000000..917d090fc7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/OMElementTestCase.java @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamReader; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.axiom.om.OMElement; + +public class OMElementTestCase extends TestCase { + private static final String IPO_XML = + "" + "" + + " " + + " Helen Zoe" + + " 47 Eden Street" + + " Cambridge" + + " CB1 1JR" + + " " + + " " + + " Robert Smith" + + " 8 Oak Avenue" + + " Old Town" + + " PA" + + " 95819" + + " " + + " " + + " " + + " Lapis necklace" + + " 1" + + " 99.95" + + " Want this for the holidays" + + " 1999-12-05" + + " " + + " " + + ""; + + public final void testStringTransform() { + String2OMElement t1 = new String2OMElement(); + OMElement element = t1.transform(IPO_XML, null); + OMElement2String t2 = new OMElement2String(); + String xml = t2.transform(element, null); + Assert.assertNotNull(xml); + Assert.assertNotNull(xml.indexOf("") != -1); + } + + public final void testStringTransform2() { + String str = + "Robert"; + String2OMElement t1 = new String2OMElement(); + OMElement element = t1.transform(str, null); + OMElement2String t2 = new OMElement2String(); + String xml = t2.transform(element, null); + Assert.assertNotNull(xml); + Assert.assertNotNull(xml.indexOf("") != -1); + } + + public final void testStAXTransform() { + String2OMElement t1 = new String2OMElement(); + OMElement element = t1.transform(IPO_XML, null); + + OMElement2XMLStreamReader t2 = new OMElement2XMLStreamReader(); + XMLStreamReader reader = t2.transform(element, null); + + XMLStreamReader2OMElement t3 = new XMLStreamReader2OMElement(); + OMElement element2 = t3.transform(reader, null); + + Assert.assertEquals(element2.getQName(), element.getQName()); + Assert.assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), element2.getQName()); + } + + public final void testCopy() { + String2OMElement t1 = new String2OMElement(); + OMElement element = t1.transform(IPO_XML, null); + OMElement copy = (OMElement)new AxiomDataBinding().copy(element); + assertNotSame(element, copy); + assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), copy.getQName()); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xml new file mode 100755 index 0000000000..58058dbe1a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xml @@ -0,0 +1,33 @@ + + + + + Helen Zoe + 47 Eden Street + Cambridge + CB1 1JR + + + + Robert Smith + 8 Oak Avenue + Old Town + PA + 95819 + + + + + Lapis necklace + 1 + 99.95 + Want this for the holidays + 1999-12-05 + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xsd b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xsd new file mode 100755 index 0000000000..5468542693 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xsd @@ -0,0 +1,118 @@ + + + + + International Purchase order schema for Example.com + Copyright 2000 Example.com. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/order.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/order.wsdl new file mode 100644 index 0000000000..cde45f12ae --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/order.wsdl @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/pom.xml new file mode 100644 index 0000000000..b5c8de523a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/pom.xml @@ -0,0 +1,89 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.testing + axis2-itest-old-style + ${testing.version} + jar + Apache Tuscany Axis2 itests old style scdl + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubator-SNAPSHOT + compile + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${scaKernelVersion} + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${scaKernelVersion} + + + junit + junit + 4.2 + test + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c9076ebba6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hi " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleReference.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleReference.composite new file mode 100644 index 0000000000..7b28443d0e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleReference.composite @@ -0,0 +1,37 @@ + + + + + + + HelloworldClientRef + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleService.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleService.composite new file mode 100644 index 0000000000..4a5c1a46b7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleService.composite @@ -0,0 +1,35 @@ + + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..68174d1ecd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java new file mode 100644 index 0000000000..ac586a940f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.test.SCATestCase; + +public class HelloWorldServer extends SCATestCase { + + private String composteFileName = "/OldStyleService.composite"; + + public HelloWorldServer(String composteFileName) { + this.composteFileName = composteFileName; + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(composteFileName); + super.setUp(); + } + + public void testPing() throws IOException, InterruptedException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/OldStyleTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/OldStyleTestCase.java new file mode 100644 index 0000000000..843643370f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/OldStyleTestCase.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + + +import helloworld.HelloWorldService; +import junit.framework.Assert; + +import org.apache.tuscany.test.SCATestCase; +import org.apache.tuscany.test.SCATestCaseRunner; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for binding.ws using pre-1.0 WS SCDL + */ +@SuppressWarnings("deprecation") +public class OldStyleTestCase extends SCATestCase { + + private SCATestCaseRunner server; + private CompositeContext compositeContext; + + private static final String CLIENT_COMPOSITE = "OldStyleReference.composite"; + private static final String SERVICE_COMPOSITE = "OldStyleService.composite"; + private static final String CLIENT_COMPONENT = "HelloworldClient"; + + public void testCallingWSWithOldStyleSCDL() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, CLIENT_COMPONENT); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("Hi Petra", msg); + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(CLIENT_COMPOSITE); + super.setUp(); + compositeContext = CurrentCompositeContext.getContext(); + + server = new SCATestCaseRunner(HelloWorldServer.class, SERVICE_COMPOSITE); + server.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + server.tearDown(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/pom.xml new file mode 100644 index 0000000000..78fce63c47 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/pom.xml @@ -0,0 +1,41 @@ + + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.axis2.itests + parent + pom + Apache Tuscany Axis2 itests + + + old-style + simplest + service-explicit-uri + service-relative-uri + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/pom.xml new file mode 100644 index 0000000000..9e87261c39 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/pom.xml @@ -0,0 +1,89 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.testing + axis2-itest-service-explicit-uri + ${testing.version} + jar + Apache Tuscany Axis2 itests service explicit uri + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubator-SNAPSHOT + compile + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${scaKernelVersion} + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${scaKernelVersion} + + + junit + junit + 4.2 + test + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c9076ebba6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hi " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/client.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/client.composite new file mode 100644 index 0000000000..2638f12a38 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/client.composite @@ -0,0 +1,36 @@ + + + + + + + HelloworldClientRefSimplest + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/service.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/service.composite new file mode 100644 index 0000000000..0e3a86b017 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/service.composite @@ -0,0 +1,35 @@ + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..d3e769d31c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java new file mode 100644 index 0000000000..8267488398 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.test.SCATestCase; + +public class HelloWorldServer extends SCATestCase { + + private String composteFileName; + + public HelloWorldServer(String composteFileName) { + this.composteFileName = composteFileName; + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(composteFileName); + super.setUp(); + } + + public void testPing() throws IOException, InterruptedException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceExplicitURITestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceExplicitURITestCase.java new file mode 100644 index 0000000000..6585037255 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceExplicitURITestCase.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + + +import helloworld.HelloWorldService; +import junit.framework.Assert; + +import org.apache.tuscany.test.SCATestCase; +import org.apache.tuscany.test.SCATestCaseRunner; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for binding.ws using pre-1.0 WS SCDL + */ +@SuppressWarnings("deprecation") +public class ServiceExplicitURITestCase extends SCATestCase { + + private SCATestCaseRunner server; + private CompositeContext compositeContext; + + private static final String CLIENT_COMPOSITE = "client.composite"; + private static final String SERVICE_COMPOSITE = "service.composite"; + private static final String CLIENT_COMPONENT = "HelloworldClient"; + + public void testSimplestBinding() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, CLIENT_COMPONENT); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("Hi Petra", msg); + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(CLIENT_COMPOSITE); + super.setUp(); + compositeContext = CurrentCompositeContext.getContext(); + + server = new SCATestCaseRunner(HelloWorldServer.class, SERVICE_COMPOSITE); + server.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + server.tearDown(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/pom.xml new file mode 100644 index 0000000000..f9a636f552 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/pom.xml @@ -0,0 +1,89 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.testing + axis2-itest-service-relative-uri + ${testing.version} + jar + Apache Tuscany Axis2 itests service relative uri + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubator-SNAPSHOT + compile + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${scaKernelVersion} + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${scaKernelVersion} + + + junit + junit + 4.2 + test + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c9076ebba6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hi " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/client.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/client.composite new file mode 100644 index 0000000000..2638f12a38 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/client.composite @@ -0,0 +1,36 @@ + + + + + + + HelloworldClientRefSimplest + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/service.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/service.composite new file mode 100644 index 0000000000..f6bcc4a6fb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/service.composite @@ -0,0 +1,35 @@ + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..766a7acd98 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java new file mode 100644 index 0000000000..8267488398 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.test.SCATestCase; + +public class HelloWorldServer extends SCATestCase { + + private String composteFileName; + + public HelloWorldServer(String composteFileName) { + this.composteFileName = composteFileName; + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(composteFileName); + super.setUp(); + } + + public void testPing() throws IOException, InterruptedException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceRelativeURITestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceRelativeURITestCase.java new file mode 100644 index 0000000000..dec0a45e3c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceRelativeURITestCase.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + + +import helloworld.HelloWorldService; +import junit.framework.Assert; + +import org.apache.tuscany.test.SCATestCase; +import org.apache.tuscany.test.SCATestCaseRunner; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for binding.ws using pre-1.0 WS SCDL + */ +@SuppressWarnings("deprecation") +public class ServiceRelativeURITestCase extends SCATestCase { + + private SCATestCaseRunner server; + private CompositeContext compositeContext; + + private static final String CLIENT_COMPOSITE = "client.composite"; + private static final String SERVICE_COMPOSITE = "service.composite"; + private static final String CLIENT_COMPONENT = "HelloworldClient"; + + public void testSimplestBinding() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, CLIENT_COMPONENT); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("Hi Petra", msg); + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(CLIENT_COMPOSITE); + super.setUp(); + compositeContext = CurrentCompositeContext.getContext(); + + server = new SCATestCaseRunner(HelloWorldServer.class, SERVICE_COMPOSITE); + server.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + server.tearDown(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/pom.xml new file mode 100644 index 0000000000..62e3a2ae46 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/pom.xml @@ -0,0 +1,89 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.testing + axis2-itest-simplest + ${testing.version} + jar + Apache Tuscany Axis2 itests simplest binding.ws + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubator-SNAPSHOT + compile + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${scaKernelVersion} + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${scaKernelVersion} + + + junit + junit + 4.2 + test + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c9076ebba6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hi " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/client.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/client.composite new file mode 100644 index 0000000000..2638f12a38 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/client.composite @@ -0,0 +1,36 @@ + + + + + + + HelloworldClientRefSimplest + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/service.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/service.composite new file mode 100644 index 0000000000..5062dc282e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/service.composite @@ -0,0 +1,35 @@ + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..446e269cd9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java new file mode 100644 index 0000000000..8267488398 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.test.SCATestCase; + +public class HelloWorldServer extends SCATestCase { + + private String composteFileName; + + public HelloWorldServer(String composteFileName) { + this.composteFileName = composteFileName; + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(composteFileName); + super.setUp(); + } + + public void testPing() throws IOException, InterruptedException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/SimplestTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/SimplestTestCase.java new file mode 100644 index 0000000000..79c1f067b5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/SimplestTestCase.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + + +import helloworld.HelloWorldService; +import junit.framework.Assert; + +import org.apache.tuscany.test.SCATestCase; +import org.apache.tuscany.test.SCATestCaseRunner; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for binding.ws using pre-1.0 WS SCDL + */ +@SuppressWarnings("deprecation") +public class SimplestTestCase extends SCATestCase { + + private SCATestCaseRunner server; + private CompositeContext compositeContext; + + private static final String CLIENT_COMPOSITE = "client.composite"; + private static final String SERVICE_COMPOSITE = "service.composite"; + private static final String CLIENT_COMPONENT = "HelloworldClient"; + + public void testSimplestBinding() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, CLIENT_COMPONENT); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("Hi Petra", msg); + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(CLIENT_COMPOSITE); + super.setUp(); + compositeContext = CurrentCompositeContext.getContext(); + + server = new SCATestCaseRunner(HelloWorldServer.class, SERVICE_COMPOSITE); + server.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + server.tearDown(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/pom.xml new file mode 100644 index 0000000000..6b9fb6694f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/pom.xml @@ -0,0 +1,90 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.testing + axis2-itest-wsdl-binding + ${testing.version} + jar + Apache Tuscany Axis2 itests service relative uri + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubator-SNAPSHOT + compile + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${scaKernelVersion} + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${scaKernelVersion} + + + + junit + junit + 4.2 + test + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c9076ebba6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hi " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/client.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/client.composite new file mode 100644 index 0000000000..889f69d1ca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/client.composite @@ -0,0 +1,37 @@ + + + + + + + HelloworldClientRefSimplest + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/service.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/service.composite new file mode 100644 index 0000000000..bd7479f429 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/service.composite @@ -0,0 +1,35 @@ + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..766a7acd98 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java new file mode 100644 index 0000000000..8267488398 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.test.SCATestCase; + +public class HelloWorldServer extends SCATestCase { + + private String composteFileName; + + public HelloWorldServer(String composteFileName) { + this.composteFileName = composteFileName; + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(composteFileName); + super.setUp(); + } + + public void testPing() throws IOException, InterruptedException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/WsdlElementBindingTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/WsdlElementBindingTestCase.java new file mode 100644 index 0000000000..ac9f7a65c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/WsdlElementBindingTestCase.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + + +import helloworld.HelloWorldService; +import junit.framework.Assert; + +import org.apache.tuscany.test.SCATestCase; +import org.apache.tuscany.test.SCATestCaseRunner; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for binding.ws using wsdlElement pointing to a WSDl binding, + * so the uri element must be used to define the actual endpoint. + * The SCA service uses a relative uri, the reference uses an absolute uri. + */ +@SuppressWarnings("deprecation") +public class WsdlElementBindingTestCase extends SCATestCase { + + private SCATestCaseRunner server; + private CompositeContext compositeContext; + + private static final String CLIENT_COMPOSITE = "client.composite"; + private static final String SERVICE_COMPOSITE = "service.composite"; + private static final String CLIENT_COMPONENT = "HelloworldClient"; + + public void testWsdlElementBinding() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, CLIENT_COMPONENT); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("Hi Petra", msg); + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(CLIENT_COMPOSITE); + super.setUp(); + compositeContext = CurrentCompositeContext.getContext(); + + server = new SCATestCaseRunner(HelloWorldServer.class, SERVICE_COMPOSITE); + server.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + server.tearDown(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/LICENSE.txt new file mode 100644 index 0000000000..9601ead3f6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/LICENSE.txt @@ -0,0 +1,1407 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Netscape Public License V1.1 + + AMENDMENTS + + The Netscape Public License Version 1.1 ("NPL") consists of the + Mozilla Public License Version 1.1 with the following Amendments, + including Exhibit A-Netscape Public License. Files identified with + "Exhibit A-Netscape Public License" are governed by the Netscape + Public License Version 1.1. + + Additional Terms applicable to the Netscape Public License. + I. Effect. + These additional terms described in this Netscape Public + License -- Amendments shall apply to the Mozilla Communicator + client code and to all Covered Code under this License. + + II. "Netscape's Branded Code" means Covered Code that Netscape + distributes and/or permits others to distribute under one or more + trademark(s) which are controlled by Netscape but which are not + licensed for use under this License. + + III. Netscape and logo. + This License does not grant any rights to use the trademarks + "Netscape", the "Netscape N and horizon" logo or the "Netscape + lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript", + "Smart Browsing" even if such marks are included in the Original + Code or Modifications. + + IV. Inability to Comply Due to Contractual Obligation. + Prior to licensing the Original Code under this License, Netscape + has licensed third party code for use in Netscape's Branded Code. + To the extent that Netscape is limited contractually from making + such third party code available under this License, Netscape may + choose to reintegrate such code into Covered Code without being + required to distribute such code in Source Code form, even if + such code would otherwise be considered "Modifications" under + this License. + + V. Use of Modifications and Covered Code by Initial Developer. + V.1. In General. + The obligations of Section 3 apply to Netscape, except to + the extent specified in this Amendment, Section V.2 and V.3. + + V.2. Other Products. + Netscape may include Covered Code in products other than the + Netscape's Branded Code which are released by Netscape + during the two (2) years following the release date of the + Original Code, without such additional products becoming + subject to the terms of this License, and may license such + additional products on different terms from those contained + in this License. + + V.3. Alternative Licensing. + Netscape may license the Source Code of Netscape's Branded + Code, including Modifications incorporated therein, without + such Netscape Branded Code becoming subject to the terms of + this License, and may license such Netscape Branded Code on + different terms from those contained in this License. + + VI. Litigation. + Notwithstanding the limitations of Section 11 above, the + provisions regarding litigation in Section 11(a), (b) and (c) of + the License shall apply to all disputes relating to this License. + + EXHIBIT A-Netscape Public License. + + "The contents of this file are subject to the Netscape Public + License Version 1.1 (the "License"); you may not use this file + except in compliance with the License. You may obtain a copy of + the License at http://www.mozilla.org/NPL/ + + Software distributed under the License is distributed on an "AS + IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + implied. See the License for the specific language governing + rights and limitations under the License. + + The Original Code is Mozilla Communicator client code, released + March 31, 1998. + + The Initial Developer of the Original Code is Netscape + Communications Corporation. Portions created by Netscape are + Copyright (C) 1998-1999 Netscape Communications Corporation. All + Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the + terms of the _____ license (the "[___] License"), in which case + the provisions of [______] License are applicable instead of + those above. If you wish to allow use of your version of this + file only under the terms of the [____] License and not to allow + others to use your version of this file under the NPL, indicate + your decision by deleting the provisions above and replace them + with the notice and other provisions required by the [___] + License. If you do not delete the provisions above, a recipient + may use your version of this file under either the NPL or the + [___] License." + + ---------------------------------------------------------------------- + + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/pom.xml new file mode 100644 index 0000000000..b722951bc1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/pom.xml @@ -0,0 +1,46 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.plugins + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-plugin-java2wsdl + maven-plugin + Apache Tuscany Axis2 Maven Plugin for Java2WSDL + Implementation of Java2WSDL Generator + + + + org.apache.maven + maven-plugin-api + 2.0 + + + org.apache.tuscany.sca.extensions.axis2.tools + tuscany-java2wsdl + ${extensionVersion} + compile + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java new file mode 100644 index 0000000000..a5f6158dcd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java @@ -0,0 +1,153 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.plugin; + +import java.util.Hashtable; +import java.util.Map; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.tuscany.tools.java2wsdl.generate.Java2WSDLGeneratorFactory; +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; + +/** + * @version $Rev$ $Date$ + * @goal generate + * @phase generate-sources + * @description Generate WSDL from a given Java class / interface + */ +public class Java2WSDLGeneratorMojo extends AbstractMojo +{ + + /** + * The name of the class for which the WSDL must be generated + * @parameter + * + */ + private String sourceClassName; + + /** + * The location where the wsdls should be generated into + * @parameter expression="${project.build.directory}\\java2wsdl-wsdl" + */ + private String targetLocation; + + /** + * The name of the wsdl file + * @parameter + */ + private String wsdlFilename; + + + /** + * Classpaths to be included + * @parameter + * + */ + String[] classpaths; + + /** + * The name of the service + * @parameter + */ + private String serviceName; + + /** + * The binding style for the service + * @parameter + */ + private String bindingStyle; + + /** + * The binding use option + * @parameter + */ + private String bindingUse; + + /** + * The soap address + * @parameter + */ + private String soapAddress; + + public void execute() throws MojoExecutionException + { + try + { + Java2WSDLGeneratorFactory.getInstance().createGenerator().generateWSDL(createOptionsMap ()); + } + catch ( Exception e ) + { + throw new MojoExecutionException("Exception in Java2WSDL Maven Plugin ", e); + } + } + + protected Map createOptionsMap() + { + Map optionsMap = new Hashtable(); + + optionsMap.put(Java2WSDLConstants.CLASSNAME_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.CLASSNAME_OPTION, new String[]{sourceClassName})); + + if ( targetLocation != null ) + { + optionsMap.put(Java2WSDLConstants.OUTPUT_LOCATION_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.OUTPUT_LOCATION_OPTION, new String[]{targetLocation})); + } + + if ( wsdlFilename != null ) + { + optionsMap.put(Java2WSDLConstants.OUTPUT_FILENAME_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.OUTPUT_FILENAME_OPTION, new String[]{wsdlFilename})); + } + + if ( classpaths != null && classpaths.length > 0 ) + { + optionsMap.put(Java2WSDLConstants.CLASSPATH_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.CLASSPATH_OPTION, classpaths)); + } + + if ( serviceName != null ) + { + optionsMap.put(Java2WSDLConstants.SERVICE_NAME_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.SERVICE_NAME_OPTION, new String[]{serviceName})); + } + + if ( bindingStyle != null ) + { + optionsMap.put(Java2WSDLConstants.STYLE_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.STYLE_OPTION, new String[]{bindingStyle})); + } + + if ( bindingUse != null ) + { + optionsMap.put(Java2WSDLConstants.USE_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.USE_OPTION, new String[]{bindingUse})); + } + + if ( soapAddress != null ) + { + optionsMap.put(Java2WSDLConstants.LOCATION_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.LOCATION_OPTION, new String[]{soapAddress})); + } + + return optionsMap; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/pom.xml new file mode 100644 index 0000000000..6561cf45c3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/pom.xml @@ -0,0 +1,39 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.axis2.plugins + parent + pom + Apache Tuscany Axis2 Maven Plugins + Maven plugins for the Axis2 extension + + + java2wsdl + wsdl2java + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/LICENSE.txt new file mode 100644 index 0000000000..9601ead3f6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/LICENSE.txt @@ -0,0 +1,1407 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Netscape Public License V1.1 + + AMENDMENTS + + The Netscape Public License Version 1.1 ("NPL") consists of the + Mozilla Public License Version 1.1 with the following Amendments, + including Exhibit A-Netscape Public License. Files identified with + "Exhibit A-Netscape Public License" are governed by the Netscape + Public License Version 1.1. + + Additional Terms applicable to the Netscape Public License. + I. Effect. + These additional terms described in this Netscape Public + License -- Amendments shall apply to the Mozilla Communicator + client code and to all Covered Code under this License. + + II. "Netscape's Branded Code" means Covered Code that Netscape + distributes and/or permits others to distribute under one or more + trademark(s) which are controlled by Netscape but which are not + licensed for use under this License. + + III. Netscape and logo. + This License does not grant any rights to use the trademarks + "Netscape", the "Netscape N and horizon" logo or the "Netscape + lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript", + "Smart Browsing" even if such marks are included in the Original + Code or Modifications. + + IV. Inability to Comply Due to Contractual Obligation. + Prior to licensing the Original Code under this License, Netscape + has licensed third party code for use in Netscape's Branded Code. + To the extent that Netscape is limited contractually from making + such third party code available under this License, Netscape may + choose to reintegrate such code into Covered Code without being + required to distribute such code in Source Code form, even if + such code would otherwise be considered "Modifications" under + this License. + + V. Use of Modifications and Covered Code by Initial Developer. + V.1. In General. + The obligations of Section 3 apply to Netscape, except to + the extent specified in this Amendment, Section V.2 and V.3. + + V.2. Other Products. + Netscape may include Covered Code in products other than the + Netscape's Branded Code which are released by Netscape + during the two (2) years following the release date of the + Original Code, without such additional products becoming + subject to the terms of this License, and may license such + additional products on different terms from those contained + in this License. + + V.3. Alternative Licensing. + Netscape may license the Source Code of Netscape's Branded + Code, including Modifications incorporated therein, without + such Netscape Branded Code becoming subject to the terms of + this License, and may license such Netscape Branded Code on + different terms from those contained in this License. + + VI. Litigation. + Notwithstanding the limitations of Section 11 above, the + provisions regarding litigation in Section 11(a), (b) and (c) of + the License shall apply to all disputes relating to this License. + + EXHIBIT A-Netscape Public License. + + "The contents of this file are subject to the Netscape Public + License Version 1.1 (the "License"); you may not use this file + except in compliance with the License. You may obtain a copy of + the License at http://www.mozilla.org/NPL/ + + Software distributed under the License is distributed on an "AS + IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + implied. See the License for the specific language governing + rights and limitations under the License. + + The Original Code is Mozilla Communicator client code, released + March 31, 1998. + + The Initial Developer of the Original Code is Netscape + Communications Corporation. Portions created by Netscape are + Copyright (C) 1998-1999 Netscape Communications Corporation. All + Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the + terms of the _____ license (the "[___] License"), in which case + the provisions of [______] License are applicable instead of + those above. If you wish to allow use of your version of this + file only under the terms of the [____] License and not to allow + others to use your version of this file under the NPL, indicate + your decision by deleting the provisions above and replace them + with the notice and other provisions required by the [___] + License. If you do not delete the provisions above, a recipient + may use your version of this file under either the NPL or the + [___] License." + + ---------------------------------------------------------------------- + + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/pom.xml new file mode 100644 index 0000000000..c82dd860ed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/pom.xml @@ -0,0 +1,46 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.plugins + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-plugin-wsdl2java + maven-plugin + Apache Tuscany Axis2 Maven Plugin for WSDL2Java + Implementation of WSDL2Java Generator + + + + org.apache.maven + maven-plugin-api + 2.0 + + + org.apache.tuscany.sca.extensions.axis2.tools + tuscany-wsdl2java + ${extensionVersion} + compile + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java new file mode 100644 index 0000000000..2d08c31326 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java @@ -0,0 +1,152 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.plugin; + +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.util.List; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator; + +/** + * @version $Rev$ $Date$ + * @goal generate + * @phase generate-sources + * @description Generate SDO interface classes from an XML Schema + */ +public class WSDL2JavaGeneratorMojo extends AbstractMojo { + /** + * The directory containing wsdl files; defaults to ${basedir}/src/main/wsdl + * @parameter expression="${basedir}/src/main/wsdl" + */ + private String wsdlDir; + + /** + * Name of the wsdl file; if omitted all files in the directory are processed + * @parameter + */ + private File wsdlFile; + + /** + * The Java package to generate into. By default the value is derived from the schema URI. + * + * @parameter + */ + private String javaPackage; + + /** + * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source + * + * @parameter expression="${project.build.directory}/wsdl2java-source" + */ + private String targetDirectory; + + /** + * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source + * + * @parameter + */ + private WSDLFileOption[] wsdlFiles; + + /** + * @parameter expression="${project.compileSourceRoots}" + * @readonly + */ + private List compilerSourceRoots; + + public void execute() throws MojoExecutionException { + + if(null != wsdlFiles){ + for(int i=0; i< wsdlFiles.length ; ++i ){ + System.err.println("wsdlFiles" + wsdlFiles[i].getFileName()); + WSDLFileOption wf = wsdlFiles[i]; + + if(null == wf.getTargetDirectory()) + wf.setTargetDirectory(targetDirectory); + if(null == wf.getJavaPackage()){ + wf.setJavaPackage(javaPackage); + } + if(wf.getFileName() == null || wf.getFileName().length() ==0){ + throw new MojoExecutionException("no fileName specfied for wsdl."); + } + if(!wf.getFileName().canRead() || !wf.getFileName().isFile()){ + + throw new MojoExecutionException("file can not be read:"+wf.getFileName()); + } + + } + }else{ + + + + if (wsdlFile == null) { + + File[] files = new File(wsdlDir).listFiles(FILTER); + + wsdlFiles= new WSDLFileOption[files.length]; + for(int i= files.length -1; i> -1; --i){ + + + wsdlFiles[i] = new WSDLFileOption(); + wsdlFiles[i].setFileName(files[i]); + wsdlFiles[i].setJavaPackage(javaPackage); + wsdlFiles[i].setPorts(null); + wsdlFiles[i].setTargetDirectory(targetDirectory); + + + } + + } else { + wsdlFiles= new WSDLFileOption[]{new WSDLFileOption()}; + wsdlFiles[0].setFileName(wsdlFile); + wsdlFiles[0].setJavaPackage(javaPackage); + wsdlFiles[0].setPorts(null); + wsdlFiles[0].setTargetDirectory(targetDirectory); + } + } + + int genOptions = 0; + + for (int i = 0; i < wsdlFiles.length; i++) { + File file = wsdlFiles[i].getFileName(); + File marker = new File(targetDirectory, ".gen#" + file.getName()+".wsdl2java"); + if (file.lastModified() > marker.lastModified()) { + getLog().info("Generating Java service interfaces from " + file); + WSDL2JavaGenerator.generateFromWSDL(file.toString(), wsdlFiles[i].getPorts(), wsdlFiles[i].getTargetDirectory(), wsdlFiles[i].getJavaPackage(), null, genOptions); + } + try { + marker.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException(e.getMessage(), e); + } + marker.setLastModified(System.currentTimeMillis()); + } + + compilerSourceRoots.add(targetDirectory); + } + + private static final FileFilter FILTER = new FileFilter() { + public boolean accept(File pathname) { + return (pathname.isFile() || !pathname.isHidden()); + } + }; +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java new file mode 100644 index 0000000000..3e6ebf0acc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.plugin; + +import java.io.File; + +public class WSDLFileOption { + /** + * Name of the wsdl file; if omitted all files in the directory are processed + * + */ + private File fileName; + + /** + * The Java package to generate into. By default the value is derived from the schema URI. + * + * + */ + private String javaPackage; + + /** + * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source + * + * + */ + private String targetDirectory; + + /** + * @parameter expression="${project.compileSourceRoots}" + * @readonly + */ + + private String ports[]; + + /** + * @parameter expression="${project.compileSourceRoots}" + * @readonly + */ + + + public WSDLFileOption(){} + + public String getJavaPackage() { + return javaPackage; + } + + public void setJavaPackage(String javaPackage) { + this.javaPackage = javaPackage; + } + + + public String[] getPorts() { + return ports; + } + + public void setPorts(String[] ports) { + this.ports = ports; + } + + public String getTargetDirectory() { + return targetDirectory; + } + + public void setTargetDirectory(String targetDirectory) { + this.targetDirectory = targetDirectory; + } + + public File getFileName() { + return fileName; + } + + public void setFileName(File fileName) { + this.fileName = fileName; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/pom.xml new file mode 100644 index 0000000000..a84a04565a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/pom.xml @@ -0,0 +1,181 @@ + + + + + + org.apache.tuscany.sca.extensions + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.axis2 + parent + pom + Apache Tuscany SCA Extensions for Axis2 + + + + apache.ws + Apache WebServices Repository + http://ws.zones.apache.org/repository/ + legacy + + + + + + stable + + true + + + binding + databinding + tools + plugins + + samples + + + + + integration + + binding + databinding + tools + plugins + itests + samples + + + + + unstable + + binding + databinding + tools + plugins + itests + samples + + + + + + + + + + org.apache.axis2 + axis2-kernel + 1.1.1 + compile + + + + org.apache.ws.commons.axiom + axiom-api + 1.2.2 + compile + + + + org.apache.ws.commons.axiom + axiom-impl + 1.2.2 + compile + + + + incubator-woden + woden + 1.0.0M6 + runtime + + + + commons-logging + commons-logging + 1.1 + compile + + + + org.apache.neethi + neethi + 2.0 + runtime + + + + org.apache.ws.commons.schema + XmlSchema + 1.2 + compile + + + + commons-httpclient + commons-httpclient + 3.0.1 + runtime + + + + javax.mail + mail + 1.4 + compile + + + + backport-util-concurrent + backport-util-concurrent + 2.2 + runtime + + + + commons-codec + commons-codec + 1.3 + runtime + + + + httpcomponents-httpcore + jakarta-httpcore + 4.0-alpha2 + runtime + + + + xerces + xercesImpl + 2.8.1 + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/LICENSE.txt new file mode 100644 index 0000000000..0084319535 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, serviceDefinition marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/pom.xml new file mode 100644 index 0000000000..22dc92db52 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/pom.xml @@ -0,0 +1,76 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-sample-calculator-ws + war + Apache Tuscany Simple WebApp Sample + A sample WebApplication showing how to include a Tuscany runtime. + + + + org.apache.tuscany.samples.sca + sample-calculator + ${tuscanyVersion} + + + + org.apache.tuscany.sca.runtime.webapp + webapp-api + ${tuscanyVersion} + + + + calculator + + + org.apache.tuscany.sca.runtime.webapp + tuscany-war-plugin + + + tuscany-war + + tuscany-war + + + + + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + ${tuscanyVersion} + + + org.apache.tuscany.sca.services.bindings + axis2 + ${tuscanyVersion} + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/readme.html b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/readme.html new file mode 100644 index 0000000000..5d4e2cfcfb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/readme.html @@ -0,0 +1,103 @@ + + + + + + + + + Tuscany Simple Calculator Sample + + + + + +

Tuscany Simple Calculator Sample

+ +

Overview

+ +

This sample illustrates the use of SCA to wire components together inside a composite. +All connections between the components are local and are defined using Java interfaces.

+ +

Location

+ +

This sample is located  in the + samples\standalone\calculator directory. All the + following commands should be issued while working in the sample + directory.

+ +

Prerequisites

+ +

Obtain the following prerequisites and install according to + their documentation.

+ + + +

Building

+ +

To build the sample  issue :

+
+mvn
+
+ +

The result after executing is in the target subdirectory the sample-calculator.jar

+ +

Setup

+ +

Set up the Tuscany standalone runtime environment using the + following command:

+
+mvn dependency:unpack 
+
+ +

After completion there should be a target\distribution subdirectory + created that has the Tuscany standalone runtime.

+ +

Running

+ +

Execute the following command: (cut and paste to command line)

+
+java -jar target/distribution/bin/launcher.jar target/sample-calculator.jar
+
+ +

Results

+ +

The sample when run should simply display to the standard + output:
+ +
3 + 2=5.0 +
3 - 2=1.0 +
3 * 2=6.0 +
3 / 2=1.5 +
+

+ + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/resources/calculator.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/resources/calculator.wsdl new file mode 100644 index 0000000000..0b97576479 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/resources/calculator.wsdl @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/default.scdl new file mode 100644 index 0000000000..deab967a2d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/default.scdl @@ -0,0 +1,35 @@ + + + + + + + CalculatorServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..200a448d24 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + + + Apache Tuscany Simple Webapp Sample + + + TuscanyFilter + org.apache.tuscany.runtime.webapp.TuscanyFilter + + + TuscanyFilter + /* + + + + org.apache.tuscany.runtime.webapp.TuscanyContextListener + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/calc.jsp b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/calc.jsp new file mode 100644 index 0000000000..7122eca852 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/calc.jsp @@ -0,0 +1,43 @@ +<%@ page import="calculator.CalculatorService" %> +<%@ page import="org.osoa.sca.CompositeContext" %> +<%@ page import="org.osoa.sca.CurrentCompositeContext" %> +<%-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% + CompositeContext context = CurrentCompositeContext.getContext(); + CalculatorService calc = context.locateService(CalculatorService.class, "CalculatorServiceComponent"); +%> + +Calculator sample + + + + + + + + + + + + +
ExpressionResult
2 + 3<%= calc.add(2, 3) %>
3 - 2<%= calc.subtract(3, 2) %>
+ + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/index.html b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/index.html new file mode 100644 index 0000000000..695c7a7f73 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/index.html @@ -0,0 +1,5 @@ + + +Hello World + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/.ruleset new file mode 100644 index 0000000000..2a06794776 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/.ruleset @@ -0,0 +1,172 @@ + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/pom.xml new file mode 100644 index 0000000000..25ee6eff03 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/pom.xml @@ -0,0 +1,76 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + tuscany-sample-helloworld-async-ws + jar + Apache Tuscany HelloWorld Web Service Sample + A sample HelloWorld Async Web Service. + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.HelloWorldServer + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/readme.htm b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/readme.htm new file mode 100644 index 0000000000..00494c1ec8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/readme.htm @@ -0,0 +1,66 @@ + + + +Tuscany +Hello World Web Service Sample + +

Tuscany +Hello World WS Sample

+

Overview

+

The Tuscany hello world ws sample shows using the Tuscany SCA +runtime in a Tomcat environment providing a web +service.

+

Location

+This sample is located  in the samples\sca\helloworldws +directory.
+

Setup

+Set up your server as described in the Tomcat +Setup.  If you are not using the pre-configured Tomcat server from the binary distribution, you will need to add + sample-helloworldws-incubating-M1.war +to your Tomcat's webapp directory. +

Running

+This service can be invoked by the Tuscany SCA helloworldwsclient or helloworldjsclient +sample.
+

Code Overview

+The source files are physically organized as shown below:
+
+
+---main
+---resources
¦ ¦ sca.module
¦ ¦
¦ +---wsdl
¦ helloworld.wsdl
¦
+---webapp
+---WEB-INF
web.xml
+

+ + + + + + + +
sca.moduleDefines the SCA module, +entryPoint and component. Defines for the HelloWorldServiceComponent +component and the Java class that implements the component For the +entryPoint it defines WSDL for the service, the Java interface provided +by the service, and wires the service to +the HelloWorldServiceComponent
helloworld.wsdlWSDL for the service.
web.xmlStandard J2EE web application's web.xml
+

You may have noticed that there is no Java source for this +components implementation.  There reason is this sample reuses +the code from the helloworld sample to implement the service. +

diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/setup.bat b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/setup.bat new file mode 100644 index 0000000000..74dca40d4c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/setup.bat @@ -0,0 +1,16 @@ +@echo off +pushd target +jar -xf ..\apache-tomcat-5.5.17.zip +popd +copy target\sample-helloworldws-1.0-SNAPSHOT.war target\apache-tomcat-5.5.17\webapps +rem pushd target\apache-tomcat-5.5.17\webapps +rem md sample-helloworldws-1.0-SNAPSHOT +rem cd sample-helloworldws-1.0-SNAPSHOT +rem jar -xf ..\sample-helloworldws-1.0-SNAPSHOT.war +pushd target\apache-tomcat-5.5.17\shared +rem jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\web\1.0-SNAPSHOT\web-1.0-SNAPSHOT-bin.zip" +jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\web\1.0-SNAPSHOT\web-1.0-SNAPSHOT-bin.zip" +popd +rem hack +mkdir target\apache-tomcat-5.5.17\shared\extension +copy target\apache-tomcat-5.5.17\shared\lib\axis2-1.0-SNAPSHOT.jar target\apache-tomcat-5.5.17\shared\extension diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldCallback.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldCallback.java new file mode 100644 index 0000000000..adc48e85a4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldCallback.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface HelloWorldCallback { + + public void getGreetingsCallback(String getGreetingsReturn); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..bfea7039ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +@Scope("COMPOSITE") +public class HelloWorldImpl implements HelloWorldService { + + private HelloWorldCallback helloWorldCallback; + + @Callback + public void setHelloWorldCallback(HelloWorldCallback helloWorldCallback) { + this.helloWorldCallback = helloWorldCallback; + } + + public String getGreetings(String name) { + try { + helloWorldCallback.getGreetingsCallback("Hola " + name); + } catch (Throwable t) { + t.printStackTrace(); + } + return "This should not be seen"; + } + + public String getGreetings1(DataObject name) { + String firstName = name.getString("firstName"); + String lastName = name.getString("lastName"); + return "Hi " + firstName + " " + lastName; + } + + public void getGreetingsWithCallback(String name) { + try { + helloWorldCallback.getGreetingsCallback("Alo " + name); + } catch (Throwable t) { + t.printStackTrace(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..3db3b0cae4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +@Callback(HelloWorldCallback.class) +public interface HelloWorldService { + + public String getGreetings(String name); + @DataType(name="commonj.sdo.DataObject") + public String getGreetings1(DataObject name); + + public void getGreetingsWithCallback(String name); + +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..11c564eb19 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..9428cd047c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/sca/default.scdl new file mode 100644 index 0000000000..8d619ea894 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/sca/default.scdl @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl new file mode 100644 index 0000000000..852f36e10d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl new file mode 100644 index 0000000000..49e8926aab --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl new file mode 100644 index 0000000000..8c1c36d466 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl new file mode 100644 index 0000000000..9a15675f9f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/webapp.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/webapp.scdl new file mode 100644 index 0000000000..123bef83ff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/webapp.scdl @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..1ffda4a82a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,51 @@ + + + + + + Tuscany HelloWorld Web Service Sample + + + tuscany.systemScdlPath + /META-INF/tuscany/webapp.scdl + + + + tuscany.applicationScdlPath + /META-INF/sca/default.scdl + + + + org.apache.tuscany.runtime.webapp.TuscanyContextListener + + + + TuscanyServlet + Tuscany Servlet + org.apache.tuscany.runtime.webapp.TuscanyServlet + + + + TuscanyServlet + /* + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/pom.xml new file mode 100644 index 0000000000..fb92f856c3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/pom.xml @@ -0,0 +1,80 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + tuscany-sample-helloworld-async-wsclient + jar + Apache Tuscany HelloWorld Web Service Async Client Sample + A sample client for a HelloWorld Web Service. + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.extensions.axis2.samples + tuscany-sample-helloworld-async-ws + test + 0.1-integration-incubating-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.HelloWorldClient + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run.bat b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run.bat new file mode 100644 index 0000000000..0b9f69d8bd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run.bat @@ -0,0 +1,53 @@ +@echo off +rem set java_debug_set=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=3720,server=y,suspend=y +mkdir target\standalone +pushd target\standalone +jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\standalone\1.0-SNAPSHOT\standalone-1.0-SNAPSHOT-bin.zip" +popd +rem move target\standalone\extension\axiom-api-1.0.jar target\standalone\boot +rem move target\standalone\extension\axiom-impl-1.0.jar target\standalone\boot +rem move target\standalone\extension\axis2-kernel-1.0.jar target\standalone\boot +rem move target\standalone\extension\common-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\commons-codec-1.3.jar target\standalone\boot +rem move target\standalone\extension\commons-httpclient-3.0.jar target\standalone\boot +rem move target\standalone\extension\ecore-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\ecore-change-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\ecore-xmi-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\junit-3.8.1.jar target\standalone\boot +rem move target\standalone\extension\neethi-1.0.1.jar target\standalone\boot +rem move target\standalone\extension\sdo-api-1.0-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\tuscany-sdo-impl-1.0-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\XmlSchema-1.0.2.jar target\standalone\boot +rem move target\standalone\extension\xsd-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\wstx-asl-2.9.3.jar target\standalone\boot +rem move target\standalone\extension\commons-logging-1.0.3.jar target\standalone\boot + + +move target\standalone\extension\axiom-api-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\axiom-impl-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\axis2-common-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\axis2-core-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\woden-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\wsdl-1.0-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\wsdl4j-1.5.2.jar target\standalone\boot +move target\standalone\extension\avalon-framework-4.1.3.jar target\standalone\boot +move target\standalone\extension\common-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\commons-codec-1.2.jar target\standalone\boot +move target\standalone\extension\commons-httpclient-3.0.jar target\standalone\boot +move target\standalone\extension\commons-logging-1.1.jar target\standalone\boot +move target\standalone\extension\ecore-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\ecore-change-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\ecore-xmi-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\junit-3.8.1.jar target\standalone\boot +move target\standalone\extension\log4j-1.2.12.jar target\standalone\boot +move target\standalone\extension\logkit-1.0.1.jar target\standalone\boot +move target\standalone\extension\neethi-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\sdo-api-1.0-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\servlet-api-2.3.jar target\standalone\boot +move target\standalone\extension\tuscany-sdo-impl-1.0-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\XmlSchema-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\xsd-2.2.1-SNAPSHOT.jar target\standalone\boot + + + +java %java_debug_set% -jar target\standalone\bin\launcher.jar --classpath "%USERPROFILE%\.m2\repository\org\apache\tuscany\samples\sca\sample-helloworldwsclient\1.0-SNAPSHOT\sample-helloworldwsclient-1.0-SNAPSHOT.jar" %* diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run_celtix.bat b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run_celtix.bat new file mode 100644 index 0000000000..4b687a6aab --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run_celtix.bat @@ -0,0 +1,16 @@ +@echo off +rem set java_debug_set=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=3720,server=y,suspend=y +mkdir target\standalone +pushd target\standalone +jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\standalone\1.0-SNAPSHOT\standalone-1.0-SNAPSHOT-bin.zip" +jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\bindings\celtix\1.0-SNAPSHOT\celtix-1.0-SNAPSHOT-bin.zip" +rem jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\bindings\axis2\1.0-SNAPSHOT\axis2-1.0-SNAPSHOT-bin.zip" + +popd +move target\standalone\extension\*.jar target\standalone\boot +copy "%USERPROFILE%\.m2\repository\org\apache\tuscany\bindings\celtix\1.0-SNAPSHOT\celtix-1.0-SNAPSHOT.jar" target\standalone\extension +copy "%USERPROFILE%\.m2\repository\org\apache\tuscany\databinding\databinding-sdo\1.0-SNAPSHOT\databinding-sdo-1.0-SNAPSHOT.jar" target\standalone\extension +rem copy "%USERPROFILE%\.m2\repository\org\apache\tuscany\bindings\axis2\1.0-SNAPSHOT\axis2-1.0-SNAPSHOT.jar" target\standalone\extension + + +java %java_debug_set% -jar target\standalone\bin\launcher.jar --classpath "%USERPROFILE%\.m2\repository\org\apache\tuscany\samples\sca\sample-helloworldwsclient\1.0-SNAPSHOT\sample-helloworldwsclient-1.0-SNAPSHOT.jar" %* diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldCallback.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldCallback.java new file mode 100644 index 0000000000..adc48e85a4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldCallback.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface HelloWorldCallback { + + public void getGreetingsCallback(String getGreetingsReturn); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldClient.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..f59c409f45 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * This client program shows how to invoke a web service asynchronously with a callback + */ + +public class HelloWorldClient { + + public final static void main(String[] args) throws Exception { + + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + HelloWorldLocal helloWorldLocal = + compositeContext.locateService(HelloWorldLocal.class, "HelloWorldServiceComponent"); + helloWorldLocal.getGreetings("John"); + + // Sleep for 5 seconds to wait the callback to happen + Thread.sleep(5000); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldLocal.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldLocal.java new file mode 100644 index 0000000000..a5b9074af0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldLocal.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + +@Service +public interface HelloWorldLocal { + + public String getGreetings(String name); + @DataType(name="commonj.sdo.DataObject") + public String getGreetings1(DataObject name); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..fc64f62a7b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + +@Remotable +@Service +@Callback(HelloWorldCallback.class) +public interface HelloWorldService { + + public String getGreetings(String name); + @DataType(name="commonj.sdo.DataObject") + public String getGreetings1(DataObject name); + + public void getGreetingsWithCallback(String name); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..132b44efd8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ + +@Service(HelloWorldLocal.class) +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldLocal, HelloWorldCallback { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } + + public String getGreetings1(DataObject name) { + return helloWorldService.getGreetings1(name); + } + + public void getGreetingsCallback(String getGreetingsReturn) { + System.out.println("Callback: " + getGreetingsReturn); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..11c564eb19 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..b0936e9916 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,46 @@ + + + + + + + + + HelloWorldService + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/logging.properties b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/logging.properties new file mode 100644 index 0000000000..78e24f1633 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/logging.properties @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..9822287a85 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java new file mode 100644 index 0000000000..535258f780 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java @@ -0,0 +1,46 @@ +package helloworld; + +import junit.framework.Assert; + +import org.apache.tuscany.test.SCATestCase; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for helloworld web service client + */ +public class HelloWorldWSAsyncClient extends SCATestCase { + + private HelloWorldLocal helloWorldLocal; + + @Override + protected void setUp() throws Exception { + try { + setApplicationSCDL(HelloWorldCallback.class, "META-INF/sca/default.scdl"); + ClassLoader classLoader = getClass().getClassLoader(); + addExtension("test.extensions", classLoader.getResource("META-INF/tuscany/test-extensions.scdl")); + + super.setUp(); + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + helloWorldLocal = + compositeContext.locateService(HelloWorldLocal.class, "HelloWorldServiceComponent"); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + public void testWSClient() throws Exception { + try { + String msg = helloWorldLocal.getGreetings("John"); + Assert.assertEquals(msg, "Hola John"); + + // Sleep for 2 seconds to wait the callback to happen + Thread.sleep(2000); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl new file mode 100644 index 0000000000..ec3643cf00 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl @@ -0,0 +1,28 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/pom.xml new file mode 100644 index 0000000000..2bc95796db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/pom.xml @@ -0,0 +1,94 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.samples + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + + 4.0.0 + tuscany-sample-helloworld-om-ws + jar + Tuscany HelloWorld Axiom Web Service Sample + A sample HelloWorld Web Service using Axiom OM. + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.ws.commons.axiom + axiom-api + 1.2.2 + compile + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.om.HelloWorldServer + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/readme.htm b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/readme.htm new file mode 100644 index 0000000000..2c0f3c2eb1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/readme.htm @@ -0,0 +1,48 @@ + + +Tuscany +Hello World Web Service Sample + +

Tuscany +Hello World WS Sample

+

Overview

+

The Tuscany hello world ws sample shows using the Tuscany SCA +runtime in a Tomcat environment providing a web +service.

+

Location

+This sample is located  in the samples\sca\helloworldws +directory.
+

Setup

+Set up your server as described in the Tomcat +Setup.  If you are not using the pre-configured Tomcat server from the binary distribution, you will need to add + sample-helloworldws-incubating-M1.war +to your Tomcat's webapp directory. +

Running

+This service can be invoked by the Tuscany SCA helloworldwsclient or helloworldjsclient +sample.
+

Code Overview

+The source files are physically organized as shown below:
+
+
+---main
+---resources
¦ ¦ sca.module
¦ ¦
¦ +---wsdl
¦ helloworldOM.wsdl
¦
+---webapp
+---WEB-INF
web.xml
+

+ + + + + + + +
sca.moduleDefines the SCA module, +entryPoint and component. Defines for the HelloWorldServiceComponent +component and the Java class that implements the component For the +entryPoint it defines WSDL for the service, the Java interface provided +by the service, and wires the service to +the HelloWorldServiceComponent
helloworldOM.wsdlWSDL for the service.
web.xmlStandard J2EE web application's web.xml
+

You may have noticed that there is no Java source for this +components implementation.  There reason is this sample reuses +the code from the helloworldOM sample to implement the service. +

diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/setup.bat b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/setup.bat new file mode 100755 index 0000000000..f612aabb75 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/setup.bat @@ -0,0 +1,16 @@ +@echo off +pushd target +jar -xf ..\apache-tomcat-5.5.17.zip +popd +copy target\sample-helloworldws-1.0-SNAPSHOT.war target\apache-tomcat-5.5.17\webapps +rem pushd target\apache-tomcat-5.5.17\webapps +rem md sample-helloworldws-1.0-SNAPSHOT +rem cd sample-helloworldws-1.0-SNAPSHOT +rem jar -xf ..\sample-helloworldws-1.0-SNAPSHOT.war +pushd target\apache-tomcat-5.5.17\shared +rem jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\web\1.0-SNAPSHOT\web-1.0-SNAPSHOT-bin.zip" +jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\web\1.0-SNAPSHOT\web-1.0-SNAPSHOT-bin.zip" +popd +rem hack +mkdir target\apache-tomcat-5.5.17\shared\extension +copy target\apache-tomcat-5.5.17\shared\lib\axis2-1.0-SNAPSHOT.jar target\apache-tomcat-5.5.17\shared\extension diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldImpl.java new file mode 100644 index 0000000000..6705ec5a4a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldImpl.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld.om; + + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public OMElement getGreetings(OMElement requestOM) { + String name = requestOM.getFirstElement().getText(); + + OMFactory omFactory = OMAbstractFactory.getOMFactory(); + OMElement responseOM = omFactory.createOMElement("getGreetingsResponse", "http://helloworld-om", "helloworld"); + OMElement param = omFactory.createOMElement("getGreetingsReturn", "http://helloworld-om", "helloworld"); + responseOM.addChild(param); + param.addChild(omFactory.createOMText("Hello " + name)); + + return responseOM; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldServer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldServer.java new file mode 100644 index 0000000000..d68a6a39ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldServer.java @@ -0,0 +1,28 @@ +package helloworld.om; + + +import java.io.IOException; + +import org.apache.tuscany.api.SCARuntime; + +public class HelloWorldServer { + + /** + * @param args + */ + public static void main(String[] args) { + + SCARuntime.start("helloworldws-om.composite"); + + try { + System.out.println("HelloWorld server started"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + SCARuntime.stop(); + System.out.println("HelloWorld server stopped"); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldService.java new file mode 100644 index 0000000000..8c17d68a4d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldService.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld.om; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Service +@Remotable +@DataType(name="org.apache.axiom.om.OMElement") +public interface HelloWorldService { + + public OMElement getGreetings(OMElement name); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/helloworldws-om.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/helloworldws-om.composite new file mode 100644 index 0000000000..e881aa2c70 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/helloworldws-om.composite @@ -0,0 +1,34 @@ + + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/wsdl/helloworld-om.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/wsdl/helloworld-om.wsdl new file mode 100644 index 0000000000..2c23e45e31 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/wsdl/helloworld-om.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/test/java/helloworld/om/HelloWorldServerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/test/java/helloworld/om/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..f14dd65ff3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/test/java/helloworld/om/HelloWorldServerTestCase.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld.om; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.api.SCARuntime; + +import junit.framework.TestCase; + +public class HelloWorldServerTestCase extends TestCase { + + @Override + protected void setUp() throws Exception { + SCARuntime.start("helloworldws-om.composite"); + } + + public void testPing() throws IOException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/pom.xml new file mode 100644 index 0000000000..18a7213ee9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/pom.xml @@ -0,0 +1,95 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.samples + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + + 4.0.0 + tuscany-sample-helloworld-om-wsclient + jar + Tuscany HelloWorld Axiom Web Service Client Sample + A sample client for a HelloWorld Web Service using Axiom. + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.ws.commons.axiom + axiom-api + 1.2.2 + compile + + + + org.apache.tuscany.sca.extensions.axis2.samples + tuscany-sample-helloworld-om-ws + runtime + 0.1-integration-incubating-SNAPSHOT + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.om.HelloWorldClient + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/run.bat b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/run.bat new file mode 100755 index 0000000000..51079f2443 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/run.bat @@ -0,0 +1,53 @@ +@echo off +rem set java_debug_set=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=3720,server=y,suspend=y +mkdir target\standalone +pushd target\standalone +jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\standalone\1.0-SNAPSHOT\standalone-1.0-SNAPSHOT-bin.zip" +popd +rem move target\standalone\extension\axiom-api-1.0.jar target\standalone\boot +rem move target\standalone\extension\axiom-impl-1.0.jar target\standalone\boot +rem move target\standalone\extension\axis2-kernel-1.0.jar target\standalone\boot +rem move target\standalone\extension\common-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\commons-codec-1.3.jar target\standalone\boot +rem move target\standalone\extension\commons-httpclient-3.0.jar target\standalone\boot +rem move target\standalone\extension\ecore-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\ecore-change-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\ecore-xmi-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\junit-3.8.1.jar target\standalone\boot +rem move target\standalone\extension\neethi-1.0.1.jar target\standalone\boot +rem move target\standalone\extension\sdo-api-1.0-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\tuscany-sdo-impl-1.0-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\XmlSchema-1.0.2.jar target\standalone\boot +rem move target\standalone\extension\xsd-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\wstx-asl-2.9.3.jar target\standalone\boot +rem move target\standalone\extension\commons-logging-1.0.3.jar target\standalone\boot + + +move target\standalone\extension\axiom-api-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\axiom-impl-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\axis2-common-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\axis2-core-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\woden-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\wsdl-1.0-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\wsdl4j-1.5.2.jar target\standalone\boot +move target\standalone\extension\avalon-framework-4.1.3.jar target\standalone\boot +move target\standalone\extension\common-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\commons-codec-1.2.jar target\standalone\boot +move target\standalone\extension\commons-httpclient-3.0.jar target\standalone\boot +move target\standalone\extension\commons-logging-1.1.jar target\standalone\boot +move target\standalone\extension\ecore-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\ecore-change-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\ecore-xmi-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\junit-3.8.1.jar target\standalone\boot +move target\standalone\extension\log4j-1.2.12.jar target\standalone\boot +move target\standalone\extension\logkit-1.0.1.jar target\standalone\boot +move target\standalone\extension\neethi-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\sdo-api-1.0-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\servlet-api-2.3.jar target\standalone\boot +move target\standalone\extension\tuscany-sdo-impl-1.0-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\XmlSchema-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\xsd-2.2.1-SNAPSHOT.jar target\standalone\boot + + + +java %java_debug_set% -jar target\standalone\bin\launcher.jar --classpath "%USERPROFILE%\.m2\repository\org\apache\tuscany\samples\sca\sample-helloworldwsclient\1.0-SNAPSHOT\sample-helloworldwsclient-1.0-SNAPSHOT.jar" %* diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldClient.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldClient.java new file mode 100644 index 0000000000..d0b3cef2af --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldClient.java @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld.om; + +import helloworld.om.HelloWorldService; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNode; +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; +import static java.lang.System.out; + + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ + + + +public class HelloWorldClient { + + private static final String TARGET_NAMESPACE = "http://helloworld-om"; + + public final static void main(String[] args) throws Exception { + + SCARuntime.start("helloworldwsclient-om.composite"); + + // Invoke the HelloWorld service + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + HelloWorldService helloWorldService= compositeContext.locateService(HelloWorldService.class, "HelloWorldServiceComponent"); + OMFactory fac= OMAbstractFactory.getOMFactory(); + + //create operation + OMElement opE = fac.createOMElement("getGreetings", TARGET_NAMESPACE, "helloworld"); + //create parm + OMElement parmE = fac.createOMElement("name", TARGET_NAMESPACE, "helloworld"); + //and value. + opE.addChild(parmE); + StringBuilder sb= new StringBuilder(1000); + for(String s : args){ + sb.append(s); + } + parmE.addChild(fac.createOMText(sb.toString())); + + OMElement value = helloWorldService.getGreetings(parmE); + printTRee(value); + + out.println(value); + out.flush(); + + SCARuntime.stop(); + } + + private static void printTRee(OMElement value) { + + out.println(value); + for(OMNode n = value.getFirstOMChild(); n != null; n= n.getNextOMSibling()){ + if(n instanceof OMElement) printTRee((OMElement) n); + else out.println(n); + } + out.flush(); + + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldService.java new file mode 100644 index 0000000000..dfeac6a8d8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldService.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld.om; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Service; +import org.osoa.sca.annotations.Remotable; + + +@Service +@Remotable +@DataType(name="org.apache.axiom.om.OMElement") +public interface HelloWorldService { + + public OMElement getGreetings(OMElement parmE); + +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..740ac68f7f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldServiceComponent.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld.om; + +import helloworld.om.HelloWorldService; + +import org.apache.axiom.om.OMElement; +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ + + +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public void setHelloWorldService(HelloWorldService helloWorldService) { + + this.helloWorldService = helloWorldService; + } + + public OMElement getGreetings(OMElement name) { + + return helloWorldService.getGreetings(name); + } + +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite new file mode 100644 index 0000000000..7b9b8fd08c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/logging.properties b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/logging.properties new file mode 100644 index 0000000000..6ff8d23044 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/logging.properties @@ -0,0 +1,27 @@ +# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/wsdl/helloworld-om.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/wsdl/helloworld-om.wsdl new file mode 100644 index 0000000000..2c23e45e31 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/wsdl/helloworld-om.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldClientTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldClientTestCase.java new file mode 100644 index 0000000000..6f3ab19d9f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldClientTestCase.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld.om; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMText; +import org.apache.tuscany.api.SCARuntime; +import org.apache.tuscany.core.test.SCATestCaseRunner; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for helloworld web service client + */ +public class HelloWorldClientTestCase extends TestCase { + + private HelloWorldService helloWorldService; + + private SCATestCaseRunner server; + + @Override + protected void setUp() throws Exception { + server = new SCATestCaseRunner(HelloWorldServerTest.class); + server.setUp(); + + SCARuntime.start("helloworldwsclient-om.composite"); + + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + helloWorldService = compositeContext.locateService(HelloWorldService.class, "HelloWorldServiceComponent"); + + } + + public void testWSClient() { + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld"); + OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld"); + requestOM.addChild(parmE); + parmE.addChild(fac.createOMText("petra")); + OMElement responseOM = helloWorldService.getGreetings(requestOM); + OMElement child = (OMElement)responseOM.getFirstElement(); + Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText()); + } + + @Override + protected void tearDown() throws Exception { + server.tearDown(); + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldServerTest.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldServerTest.java new file mode 100644 index 0000000000..0c78f9c9be --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldServerTest.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld.om; + +import java.io.IOException; +import java.net.Socket; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; + +public class HelloWorldServerTest extends TestCase { + + @Override + protected void setUp() throws Exception { + SCARuntime.start("helloworldws-om.composite"); + } + + public void testPing() throws IOException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/pom.xml new file mode 100644 index 0000000000..599e2e44af --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/pom.xml @@ -0,0 +1,136 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-sample-helloworld-oneway-ws + war + Tuscany Greeter Web Service Sample + A sample Greeter OneWay Web Service. + + + axis2 + + + + + org.osoa + sca-api-r1.0 + 0.1-integration-incubating-SNAPSHOT + compile + + + org.apache.tuscany.sca.kernel + tuscany-api + ${pom.version} + compile + + + + commonj + sdo-api-r2.1 + 0.1-integration-incubating-SNAPSHOT + compile + + + org.apache.tuscany.sca.kernel + tuscany-core + ${pom.version} + runtime + + + javax.servlet + servlet-api + 2.5 + provided + + + org.apache.tuscany.sca.services.bindings + axis2 + ${pom.version} + runtime + + + org.apache.tuscany.sca.services.databinding + databinding-axiom + ${pom.version} + runtime + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${pom.version} + runtime + + + org.apache.tuscany.sca.runtime.webapp + webapp-api + ${pom.version} + runtime + + + org.apache.tuscany.sca.runtime.webapp + webapp-host + ${pom.version} + runtime + + + org.apache.ws.commons.axiom + axiom-api + SNAPSHOT + compile + + + org.apache.ws.commons.axiom + axiom-impl + SNAPSHOT + runtime + + + junit + junit + 4.2 + test + + + + + + sample-greeterws-oneway-0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.runtime.webapp + tuscany-war-plugin + + + tuscany-war + + tuscany-war + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterImpl.java new file mode 100644 index 0000000000..a38187b552 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterImpl.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package greeter; + +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(GreeterService.class) +@Scope("COMPOSITE") +public class GreeterImpl implements GreeterService { + + public void greet(String name) { + System.out.println("Hello " + name); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterService.java new file mode 100644 index 0000000000..fef29e17e5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package greeter; + +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +@Remotable +@Service +public interface GreeterService { + + @OneWay + public void greet(String name); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/resources/wsdl/greeter.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/resources/wsdl/greeter.wsdl new file mode 100644 index 0000000000..9dfe244d8e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/resources/wsdl/greeter.wsdl @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/sca/default.scdl new file mode 100644 index 0000000000..b1dbb078c6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/sca/default.scdl @@ -0,0 +1,40 @@ + + + + + + + + + + + GreeterServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl new file mode 100644 index 0000000000..852f36e10d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl new file mode 100644 index 0000000000..6c902e24ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl new file mode 100644 index 0000000000..8c1c36d466 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl new file mode 100644 index 0000000000..b30777b8c6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/webapp.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/webapp.scdl new file mode 100644 index 0000000000..f7d51a1437 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/webapp.scdl @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..8bfbd86496 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,51 @@ + + + + + + Tuscany Greeter Web Service Sample + + + tuscany.systemScdlPath + /META-INF/tuscany/webapp.scdl + + + + tuscany.applicationScdlPath + /META-INF/sca/default.scdl + + + + org.apache.tuscany.runtime.webapp.TuscanyContextListener + + + + TuscanyServlet + Tuscany Servlet + org.apache.tuscany.runtime.webapp.TuscanyServlet + + + + TuscanyServlet + /* + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/pom.xml new file mode 100644 index 0000000000..d234485b09 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/pom.xml @@ -0,0 +1,96 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-sample-helloworld-oneway-wsclient + jar + Tuscany HelloWorld Web Service Async Client Sample + A sample client for a HelloWorld Web Service. + + axis2 + + + + + commonj + sdo-api-r2.1 + ${tuscanyVersion} + compile + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.services.bindings + axis2 + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + greeter.GreeterClient + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterClient.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterClient.java new file mode 100644 index 0000000000..1aa3dce320 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterClient.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package greeter; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +public class GreeterClient { + + public final static void main(String[] args) throws Exception { + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + GreeterLocal greeterLocal = + compositeContext.locateService(GreeterLocal.class, "GreeterServiceComponent"); + greeterLocal.greet("John"); + System.out.println("Sleeping for 5 seconds ..."); + Thread.sleep(5000); + System.out.println("Done ..."); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterImpl.java new file mode 100644 index 0000000000..fc17992dbf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterImpl.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package greeter; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; + +@Scope("COMPOSITE") +public class GreeterImpl implements GreeterLocal { + + private GreeterService greeterService; + + @Reference + public void setGreeterService(GreeterService greeterService) { + this.greeterService = greeterService; + } + + public void greet(String name) { + this.greeterService.greet(name); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterLocal.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterLocal.java new file mode 100644 index 0000000000..7cf650f73b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterLocal.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package greeter; + +public interface GreeterLocal { + public void greet(String name); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterService.java new file mode 100644 index 0000000000..57279b8a7c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterService.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package greeter; + +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +@Remotable +@Service +public interface GreeterService { + @OneWay + public void greet(String name); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..c450e10408 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,42 @@ + + + + + + + + + + + GreeterService + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/wsdl/greeter.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/wsdl/greeter.wsdl new file mode 100644 index 0000000000..9dfe244d8e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/wsdl/greeter.wsdl @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/java/greeter/GreeterWSOneWayClient.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/java/greeter/GreeterWSOneWayClient.java new file mode 100644 index 0000000000..1f017744de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/java/greeter/GreeterWSOneWayClient.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package greeter; + +import org.apache.tuscany.test.SCATestCase; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +public class GreeterWSOneWayClient extends SCATestCase { + + private GreeterLocal greeterLocal; + + @Override + protected void setUp() throws Exception { + try { + setApplicationSCDL(GreeterService.class, "META-INF/sca/default.scdl"); + ClassLoader classLoader = getClass().getClassLoader(); + addExtension("test.extensions", classLoader.getResource("META-INF/tuscany/test-extensions.scdl")); + + super.setUp(); + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + greeterLocal = compositeContext.locateService(GreeterLocal.class, "GreeterServiceComponent"); + } catch (Exception e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } + + public void testWSClient() { + try { + greeterLocal.greet("John"); + + System.out.println("Sleeping ..."); + Thread.sleep(5000); + + System.out.println("Done ..."); + } catch (Exception e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl new file mode 100644 index 0000000000..ec3643cf00 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl @@ -0,0 +1,28 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/pom.xml new file mode 100644 index 0000000000..cb389d168b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/pom.xml @@ -0,0 +1,83 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.samples + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + + 4.0.0 + tuscany-sample-helloworld-ws + jar + Tuscany HelloWorld Web Service Sample + A sample HelloWorld Web Service. + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.HelloWorldServer + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..0de3c70303 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldServer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..2f09cd77f0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,28 @@ +package helloworld; + + +import java.io.IOException; + +import org.apache.tuscany.api.SCARuntime; + +public class HelloWorldServer { + + /** + * @param args + */ + public static void main(String[] args) { + + SCARuntime.start("helloworldws.composite"); + + try { + System.out.println("HelloWorld server started"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + SCARuntime.stop(); + System.out.println("HelloWorld server stopped"); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/helloworldws.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/helloworldws.composite new file mode 100644 index 0000000000..ac1bb3f20d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/helloworldws.composite @@ -0,0 +1,33 @@ + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/system.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/system.composite new file mode 100644 index 0000000000..c288471c14 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/system.composite @@ -0,0 +1,36 @@ + + + + + + + + + + 8080 + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..0b95fbd14f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/test/java/helloworld/HelloWorldServerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/test/java/helloworld/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..c2d1a5067b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/test/java/helloworld/HelloWorldServerTestCase.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.api.SCARuntime; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import junit.framework.TestCase; + +public class HelloWorldServerTestCase { + + @Before + public void startServer() throws Exception { + SCARuntime.start("helloworldws.composite"); + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8080); + } + + @After + public void stopServer() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/pom.xml new file mode 100644 index 0000000000..cef8bc7885 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/pom.xml @@ -0,0 +1,87 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.samples + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + + 4.0.0 + tuscany-sample-helloworld-wsclient + jar + Tuscany HelloWorld Web Service Client Sample + A sample client for a HelloWorld Web Service. + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.extensions.axis2.samples + tuscany-sample-helloworld-ws + runtime + 0.1-integration-incubating-SNAPSHOT + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.HelloWorldClient + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldClient.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..764cdac3bd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +public class HelloWorldClient { + + public final static void main(String[] args) throws Exception { + SCARuntime.start("helloworldwsclient.composite"); + + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + HelloWorldService helloWorldService= compositeContext.locateService(HelloWorldService.class, "HelloWorldServiceComponent"); + String value = helloWorldService.getGreetings("World"); + System.out.println(value); + + SCARuntime.stop(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..82ce2d6db8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +@Remotable +@Service +public interface HelloWorldService { + public String getGreetings(String name); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite new file mode 100644 index 0000000000..07f930ba37 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/logging.properties b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/logging.properties new file mode 100644 index 0000000000..3dca310cdb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/logging.properties @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..0b95fbd14f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldClientTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldClientTestCase.java new file mode 100644 index 0000000000..ef45608d69 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldClientTestCase.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.apache.tuscany.core.test.SCATestCaseRunner; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for helloworld web service client + */ +public class HelloWorldClientTestCase { + + private HelloWorldService helloWorldService; + + private SCATestCaseRunner server; + + @Before + public void startClient() throws Exception { + SCARuntime.start("helloworldwsclient.composite"); + + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + helloWorldService = compositeContext.locateService(HelloWorldService.class, "HelloWorldServiceComponent"); + + server = new SCATestCaseRunner(HelloWorldServerTest.class); + server.before(); + } + + @Test + public void testWSClient() throws Exception { + String msg = helloWorldService.getGreetings("Smith"); + Assert.assertEquals("Hello Smith", msg); + } + + @After + public void stopClient() throws Exception { + server.after(); + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldServerTest.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldServerTest.java new file mode 100644 index 0000000000..647398281b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldServerTest.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.api.SCARuntime; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class HelloWorldServerTest { + + @Before + public void startServer() throws Exception { + SCARuntime.start("helloworldws.composite"); + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8080); + } + + @After + public void stopServer() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/pom.xml new file mode 100644 index 0000000000..df0bfcb34b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/pom.xml @@ -0,0 +1,85 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-sample-loanapplication-ws + war + Tuscany Loan App Conversation Web Service Sample + A sample implementation of a loan application conversation web service. + + + + org.osoa + sca-api-r1.0 + + + org.apache.tuscany.sca.runtime.webapp + webapp-api + ${scaImplVersion} + runtime + + + + + ${artifactId} + + + org.apache.tuscany.sca.runtime.webapp + tuscany-war-plugin + ${scaImplVersion} + + + tuscany-war + + tuscany-war + + + + + + + false + + + + + org.apache.tuscany.sca.services.bindings + axis2 + ${scaImplVersion} + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanApplication.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanApplication.java new file mode 100644 index 0000000000..68564f1376 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanApplication.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanappconversation; + +public class LoanApplication { + + private String customerName; + private float loanAmount; + + public LoanApplication(String customerName, float loanAmount) { + this.customerName = customerName; + this.loanAmount = loanAmount; + } + + public String toString() { + return "[Customer: " + customerName + ", loan amount: " + + loanAmount + "]"; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanService.java new file mode 100644 index 0000000000..4156c2e72e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanService.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanappconversation; + +import org.osoa.sca.annotations.AllowsPassByReference; +import org.osoa.sca.annotations.EndConversation; +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Scope; + +@Scope("CONVERSATION") +@Remotable +@AllowsPassByReference // bypasses the PassByValueIntercept error. +public interface LoanService { + //prim void apply(LoanApplication application); + void apply(String customerName, float loanAmount); + void lockCurrentRate(int termInYears); + @OneWay + void cancelApplication(); + String getLoanStatus(); + String display(); + @EndsConversation + void close(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanServiceImpl.java new file mode 100644 index 0000000000..c0c7d9a455 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanServiceImpl.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanappconversation; + +import org.osoa.sca.annotations.AllowsPassByReference; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Scope("CONVERSATION") +@AllowsPassByReference // bypasses the PassByValueIntercept error. +@Remotable +@Service(LoanService.class) +public class LoanServiceImpl implements LoanService { + + private LoanApplication application; + private String status; + private int termLocked = 0; + + private void apply(LoanApplication application) { + this.application = application; + status = "open"; + } + //prim + public void apply(String customerName, float loanAmount) { + apply(new LoanApplication(customerName, loanAmount)); + + } + + public void lockCurrentRate(int termInYears) { + termLocked = termInYears; + status = "locked"; + } + + public void cancelApplication() { + status = "cancelled"; + } + + public String getLoanStatus() { + return status; + } + + public String display() { + return "Loan application: " + application + ", term: " + + termLocked + ", status: " + status; + } + + public void close() { + this.application = null; + this.status = "closed"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/resources/wsdl/loanappconversation.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/resources/wsdl/loanappconversation.wsdl new file mode 100644 index 0000000000..6822aa8c5d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/resources/wsdl/loanappconversation.wsdl @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/default.scdl new file mode 100644 index 0000000000..a35af74047 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/default.scdl @@ -0,0 +1,41 @@ + + + + + + + + + + + + LoanServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..6449f9d232 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,51 @@ + + + + + + + A sample implementation of a loan application conversation web service. + + + + tuscany.online + true + + + + + org.apache.tuscany.runtime.webapp.TuscanyContextListener + + + + TuscanyServlet + Tuscany Servlet + org.apache.tuscany.runtime.webapp.TuscanyServlet + + + + TuscanyServlet + /* + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/pom.xml new file mode 100644 index 0000000000..7ba7dbbf6e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/pom.xml @@ -0,0 +1,85 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-sample-loanapplication-wsclient + jar + Tuscany Loan App Conversation WS Client + A sample implementation conversation WS client. + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.services.bindings + axis2 + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + loanappconversation.LoanAppConversationClient + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.3 + + true + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanAppConversationClient.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanAppConversationClient.java new file mode 100644 index 0000000000..6272821083 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanAppConversationClient.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanappconversation; + +//import org.apache.tuscany.spi.component.TargetNotFoundException; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +public class LoanAppConversationClient { + + public static void main(String[] args) throws Exception { + // Locate the MyClient component and invoke it + CompositeContext context = CurrentCompositeContext.getContext(); + + LoanClient loanClient = context.locateService(LoanClient.class, "LoanClientComponent"); + assert loanClient != null : "loanClient was not resolved!"; + loanClient.applyForLoan("John Doe", 1000.0f); + assert loanClient.isOpen() : "Failed loan not in approved state"; + System.out.println("Loan opened: " + loanClient.displayLoan()); + + + loanClient.cancelLoan(); + System.out.println("Sleeping to let cancel complete ..."); + Thread.sleep(5000); + + assert loanClient.isCancelled() : "Failed to cancel loan"; + System.out.println("Cancelled: " + loanClient.displayLoan()); + + loanClient.closeLoan(); + + System.out.println("Closing for a second time!"); + try{ + loanClient.closeLoan(); + assert false : "close for second time incorrectly succeed"; + System.out.println("Failed: close for second time incorrectly succeed."); + }catch(Exception e){ + System.out.println("Second close successfully produced: '" + e.getClass().getName() +"'"); + } + + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanApplication.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanApplication.java new file mode 100644 index 0000000000..68564f1376 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanApplication.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanappconversation; + +public class LoanApplication { + + private String customerName; + private float loanAmount; + + public LoanApplication(String customerName, float loanAmount) { + this.customerName = customerName; + this.loanAmount = loanAmount; + } + + public String toString() { + return "[Customer: " + customerName + ", loan amount: " + + loanAmount + "]"; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClient.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClient.java new file mode 100644 index 0000000000..2de67508f6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClient.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanappconversation; + +public interface LoanClient { + + void applyForLoan(String customerName, float amount); + boolean isApproved(); + boolean isOpen(); + boolean isCancelled(); + String displayLoan(); + void cancelLoan(); + void closeLoan(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClientImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClientImpl.java new file mode 100644 index 0000000000..0869e1591a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClientImpl.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanappconversation; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; + +@Scope("COMPOSITE") +public class LoanClientImpl implements LoanClient { + + private LoanService loanService; + + public boolean isApproved() { + return "approved".equals(loanService.getLoanStatus()); + } + + public boolean isOpen() { + return "open".equals(loanService.getLoanStatus()); + + } + + public boolean isCancelled() { + return "cancelled".equals(loanService.getLoanStatus()); + } + + @Reference + public void setLoanService(LoanService loanService) { + this.loanService = loanService; + } + + public void applyForLoan(String customerName, float amount) { + //prim loanService.apply(new LoanApplication(customerName, amount)); + loanService.apply(customerName, amount); + } + + public String displayLoan() { + return loanService.display(); + } + + public void cancelLoan() { + loanService.cancelApplication(); + } + + public void closeLoan() { + loanService.close(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanService.java new file mode 100644 index 0000000000..f516825229 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanService.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanappconversation; + +import org.osoa.sca.annotations.AllowsPassByReference; +import org.osoa.sca.annotations.EndsConversation; +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Scope; + +@AllowsPassByReference // bypasses the PassByValueIntercept error. +@Scope("CONVERSATION") +@Remotable +public interface LoanService { + //prim void apply(LoanApplication application); + void apply(String customerName, float loanAmount); + void lockCurrentRate(int termInYears); + @OneWay + void cancelApplication(); + String getLoanStatus(); + String display(); + @EndsConversation + void close(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..7d1d13eb54 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,40 @@ + + + + + + + LoanService + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/wsdl/loanappconversation.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/wsdl/loanappconversation.wsdl new file mode 100644 index 0000000000..6822aa8c5d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/wsdl/loanappconversation.wsdl @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/test/java/loanappconversation/LoanAppConversationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/test/java/loanappconversation/LoanAppConversationTestCase.java new file mode 100644 index 0000000000..5ab428cf27 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/test/java/loanappconversation/LoanAppConversationTestCase.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanappconversation; + +import org.apache.tuscany.spi.component.TargetNotFoundException; +import org.apache.tuscany.test.SCATestCase; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +public class LoanAppConversationTestCase extends SCATestCase { + + private LoanClient loanClient; + + protected void setUp() throws Exception { + try { + setApplicationSCDL(LoanClient.class, "META-INF/sca/default.scdl"); + super.setUp(); + + CompositeContext context = CurrentCompositeContext.getContext(); + loanClient = context.locateService(LoanClient.class, "LoanClientComponent"); + } catch(Throwable e) { + e.printStackTrace(); + } + } + + public void test() throws Exception { + try { + loanClient.applyForLoan("John Doe", 1000.0f); + System.out.println("Applied: " + loanClient.displayLoan()); + System.out.println("Loan approved: " + loanClient.isApproved()); + loanClient.cancelLoan(); + System.out.println("Sleeping to let cancel complete ..."); + Thread.sleep(500); + System.out.println("Cancelled: " + loanClient.displayLoan()); + loanClient.closeLoan(); + try { + System.out.println("Trying to use the closed loan in the ended conversation ..."); + System.out.println("Closed: " + loanClient.displayLoan()); + fail("Target should not be found"); + } catch(Exception e) { + System.out.println("Target not found as expected"); + } + } catch(Throwable e) { + e.printStackTrace(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/pom.xml new file mode 100644 index 0000000000..4cf1a72f07 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/pom.xml @@ -0,0 +1,121 @@ + + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.axis2.samples + parent + pom + Tuscany Samples for the Axis2 extension + + + + + apache.snapshots + Apache Snapshot Repository + http://people.apache.org/repo/m2-snapshot-repository + + false + + + true + + + + apache.incubator + Apache Incubator Repository + http://people.apache.org/repo/m2-incubating-repository/ + + true + + + false + + + + + + + stable + + true + + + helloworld-ws + helloworld-wsclient + helloworld-om-ws + helloworld-om-wsclient + + + + + integration + + helloworld-ws + helloworld-wsclient + helloworld-om-ws + helloworld-om-wsclient + helloworld-async-ws + helloworld-async-wsclient + + + + + unstable + + helloworld-ws + helloworld-wsclient + helloworld-om-ws + helloworld-om-wsclient + helloworld-async-ws + helloworld-async-wsclient + + + + + + + + + org.codehaus.mojo + dependency-maven-plugin + + + + org.apache.tuscany.distribution.sca + standalone + ${scaImplVersion} + bin + zip + + + ${project.build.directory}/distribution + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/pom.xml new file mode 100644 index 0000000000..c6f29fcea8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/pom.xml @@ -0,0 +1,164 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.tools + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-java2wsdl + Apache Tuscany Axis2 Java2WSDL Tool + Apache Tuscany Axis2 Java2WSDL Tool + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + + + + stax + stax-api + + + + wsdl4j + wsdl4j + + + + org.apache.neethi + neethi + + + + org.apache.ws.commons.schema + XmlSchema + + + + org.apache.ws.commons.axiom + axiom-api + + + + xerces + xercesImpl + + + + org.apache.ws.commons.axiom + axiom-impl + + + + org.apache.axis2 + axis2-kernel + + + + org.apache.axis2 + axis2-java2wsdl + + + + org.apache.axis2 + axis2-codegen + + + + org.eclipse.emf + codegen + + + + org.eclipse.emf + codegen-ecore + + + + annogen + annogen + + + + commons-logging + commons-logging + + + + org.codehaus.woodstox + wstx-asl + + + + junit + junit + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.0 + + + add-test-source + generate-sources + + add-test-source + + + + target/sdo-source + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + 1.0-incubator-SNAPSHOT + + + generate-sdo + generate-test-sources + + ${basedir}/src/test/resources/CreditScoreDocLit.wsdl + org.example.creditscore.doclit + true + true + true + + + generate + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java new file mode 100644 index 0000000000..3cb699681c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java @@ -0,0 +1,435 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Map; + +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; + +/** + * This class encapsulates the parameters that effect the generation of the + * WSDL. For example they contain all user settings such as source class, + * target location etc. + * + */ +public class GenerationParameters implements TuscanyJava2WSDLConstants +{ + public static final String WSDL_FILENAME_SUFFIX = ".wsdl"; + public static final String XSD_IMPORT_DELIMITER = "[,]"; + + private Map cmdLineOptions = null; + private FileOutputStream outputFileStream = null; + private String sourceClassName = null; + + private ArrayList extraClasses; + private String attrFormDefault = null; + private String elementFormDefault = null; + private String targetNamespace = null; + private String targetNamespacePrefix = null; + private String schemaTargetNamespace = null; + private String schemaTargetNamespacePrefix = null; + private ClassLoader classLoader = null; + private String serviceName = null; + private String style = DOCUMENT; + private String use = LITERAL; + private String locationUri = DEFAULT_LOCATION_URL; + private Map schemaLocationMap = null; + + public GenerationParameters(Map cmdLineOptions) throws Exception + { + this.cmdLineOptions = cmdLineOptions; + loadParameters(); + } + + protected void loadParameters() throws Exception + { + initializeSourceClassName(); + resolveFileOutputStream(); + resolveClassLoader4InputClasspath(); + loadSchemaLocationMap(); + initializeOtherParams(); + } + + private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption) { + //short option gets precedence + Java2WSDLCommandLineOption option = null; + if (longOption != null) { + option = (Java2WSDLCommandLineOption) cmdLineOptions.get(longOption); + if (option != null) { + return option; + } + } + if (shortOption != null) { + option = (Java2WSDLCommandLineOption) cmdLineOptions.get(shortOption); + } + + return option; + } + + protected void initializeSourceClassName() throws Exception + { + Java2WSDLCommandLineOption option = + loadOption(CLASSNAME_OPTION, CLASSNAME_OPTION_LONG); + sourceClassName = option == null ? null : option.getOptionValue(); + + if (sourceClassName == null || sourceClassName.equals("")) { + throw new Exception("class name must be present!"); + } + } + + /** + * @throws Exception + */ + protected void resolveFileOutputStream() throws Exception + { + File outputFolder; + Java2WSDLCommandLineOption option = loadOption(OUTPUT_LOCATION_OPTION, + OUTPUT_LOCATION_OPTION_LONG); + String outputFolderName = option == null ? System.getProperty("user.dir") : option.getOptionValue(); + + outputFolder = new File(outputFolderName); + if (!outputFolder.exists()) { + outputFolder.mkdirs(); + } else if (!outputFolder.isDirectory()) { + throw new Exception("The specified location " + outputFolderName + "is not a folder"); + } + + option = loadOption(OUTPUT_FILENAME_OPTION, + OUTPUT_FILENAME_OPTION_LONG); + String outputFileName = option == null ? null : option.getOptionValue(); + //derive a file name from the class name if the filename is not specified + if (outputFileName == null) + { + outputFileName = Java2WSDLUtils.getSimpleClassName(sourceClassName) + WSDL_FILENAME_SUFFIX; + } + + //first create a file in the given location + File outputFile = new File(outputFolder, outputFileName); + try + { + if (!outputFile.exists()) + { + outputFile.createNewFile(); + } + outputFileStream = new FileOutputStream(outputFile); + } + catch (IOException e) + { + throw new Exception(e); + } + } + + protected void addToSchemaLocationMap(String optionValue) throws Exception + { + //option value will be of the form [namespace, schemalocation] + //hence we take the two substrings starting after '[' and upto ',' and + //starting after ',' and upto ']' + getSchemaLocationMap().put(optionValue.substring(1, optionValue.indexOf(COMMA)), + optionValue.substring(optionValue.indexOf(COMMA) + 1, optionValue.length() - 1)); + + + } + + protected void loadSchemaLocationMap() throws Exception + { + Java2WSDLCommandLineOption option = loadOption(IMPORT_XSD_OPTION, IMPORT_XSD_OPTION_LONG); + + if (option != null) + { + ArrayList optionValues = option.getOptionValues(); + + for ( int count = 0 ; count < optionValues.size() ; ++count ) + { + addToSchemaLocationMap(((String)optionValues.get(count)).trim()); + } + } + } + + protected void resolveClassLoader4InputClasspath() throws Exception + { + Java2WSDLCommandLineOption option = + loadOption(CLASSPATH_OPTION, CLASSPATH_OPTION_LONG); + + if (option != null) { + ArrayList optionValues = option.getOptionValues(); + URL[] urls = new URL[optionValues.size()]; + String[] classPathEntries = (String[]) optionValues.toArray(new String[optionValues.size()]); + + try { + for (int i = 0; i < classPathEntries.length; i++) { + String classPathEntry = classPathEntries[i]; + //this should be a file(or a URL) + if (Java2WSDLUtils.isURL(classPathEntry)) { + urls[i] = new URL(classPathEntry); + } else { + urls[i] = new File(classPathEntry).toURL(); + } + } + } catch (MalformedURLException e) { + throw new Exception(e); + } + + classLoader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader()); + + } else { + classLoader = Thread.currentThread().getContextClassLoader(); + } + } + + protected void initializeOtherParams() + { +// set the other parameters to the builder + Java2WSDLCommandLineOption option = loadOption(SCHEMA_TARGET_NAMESPACE_OPTION, + SCHEMA_TARGET_NAMESPACE_OPTION_LONG); + schemaTargetNamespace = (option == null) ? null : option.getOptionValue(); + + option = loadOption(SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION, + SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG); + schemaTargetNamespacePrefix = (option == null) ? null : option.getOptionValue(); + + option = loadOption(TARGET_NAMESPACE_OPTION, + TARGET_NAMESPACE_OPTION_LONG); + targetNamespace = (option == null) ? null : option.getOptionValue(); + + option = loadOption(TARGET_NAMESPACE_PREFIX_OPTION, + TARGET_NAMESPACE_PREFIX_OPTION_LONG); + targetNamespacePrefix = (option == null) ? null : option.getOptionValue(); + + option = loadOption(SERVICE_NAME_OPTION, + SERVICE_NAME_OPTION_LONG); + serviceName = (option == null) ? Java2WSDLUtils.getSimpleClassName(sourceClassName) : option.getOptionValue(); + + option = loadOption(STYLE_OPTION,STYLE_OPTION); + style = (option == null) ? null : option.getOptionValue(); + + + option = loadOption(LOCATION_OPTION, + LOCATION_OPTION); + locationUri = (option == null) ? null : option.getOptionValue(); + + option = loadOption(USE_OPTION,USE_OPTION); + use = (option == null) ? null : option.getOptionValue(); + + option = loadOption(ATTR_FORM_DEFAULT_OPTION, ATTR_FORM_DEFAULT_OPTION_LONG); + attrFormDefault = (option == null) ? null : option.getOptionValue(); + + option = loadOption(ELEMENT_FORM_DEFAULT_OPTION,ELEMENT_FORM_DEFAULT_OPTION_LONG); + elementFormDefault = option == null ? null : option.getOptionValue(); + + option = loadOption(TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION, + TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION_LONG); + extraClasses = option == null ? new ArrayList() : option.getOptionValues(); + } + + public ClassLoader getClassLoader() + { + return classLoader; + } + + public void setClassLoader(ClassLoader classLoader) + { + this.classLoader = classLoader; + } + + public String getLocationUri() + { + if ( locationUri == null ) + { + locationUri = DEFAULT_LOCATION_URL; + } + return locationUri; + } + + public void setLocationUri(String locationUri) + { + this.locationUri = locationUri; + } + + public FileOutputStream getOutputFileStream() + { + return outputFileStream; + } + + public void setOutputFileStream(FileOutputStream outputFileStream) + { + this.outputFileStream = outputFileStream; + } + + public String getSchemaTargetNamespace() throws Exception + { + if (schemaTargetNamespace == null + || schemaTargetNamespace.trim().equals("")) + { + this.schemaTargetNamespace = Java2WSDLUtils + .schemaNamespaceFromClassName(getSourceClassName(), getClassLoader()).toString(); + } + return schemaTargetNamespace; + } + + public void setSchemaTargetNamespace(String schemaTargetNamespace) + { + this.schemaTargetNamespace = schemaTargetNamespace; + } + + public String getSchemaTargetNamespacePrefix() + { + if (schemaTargetNamespacePrefix == null + || schemaTargetNamespacePrefix.trim().equals("")) + { + this.schemaTargetNamespacePrefix = SCHEMA_NAMESPACE_PRFIX; + } + + return schemaTargetNamespacePrefix; + } + + public void setSchemaTargetNamespacePrefix(String schemaTargetNamespacePrefix) + { + this.schemaTargetNamespacePrefix = schemaTargetNamespacePrefix; + } + + public String getServiceName() + { + if ( serviceName == null ) + { + serviceName = Java2WSDLUtils.getSimpleClassName(getSourceClassName()); + } + return serviceName; + } + + public void setServiceName(String serviceName) + { + this.serviceName = serviceName; + } + + public String getSourceClassName() + { + return sourceClassName; + } + + public void setSourceClassName(String sourceClassName) + { + this.sourceClassName = sourceClassName; + } + + public String getStyle() + { + if ( style == null ) + { + style = DOCUMENT; + } + return style; + } + + public void setStyle(String style) + { + this.style = style; + } + + public String getTargetNamespace() throws Exception + { + if ( targetNamespace == null ) { + targetNamespace = Java2WSDLUtils.namespaceFromClassName(this.sourceClassName, this.classLoader).toString(); + } + return targetNamespace; + } + + public void setTargetNamespace(String targetNamespace) + { + this.targetNamespace = targetNamespace; + } + + public String getTargetNamespacePrefix() + { + return targetNamespacePrefix; + } + + public void setTargetNamespacePrefix(String targetNamespacePrefix) + { + this.targetNamespacePrefix = targetNamespacePrefix; + } + + public String getUse() + { + if ( use == null ) + { + use = LITERAL; + } + return use; + } + + public void setUse(String use) + { + this.use = use; + } + + public Map getSchemaLocationMap() + { + if ( schemaLocationMap == null ) + { + schemaLocationMap = new Hashtable(); + } + return schemaLocationMap; + } + + public void setSchemaLocationMap(Map schemaLocationMap) { + this.schemaLocationMap = schemaLocationMap; + } + + public String getAttrFormDefault() { + if ( attrFormDefault == null ) + { + attrFormDefault = FORM_DEFAULT_QUALIFIED; + } + return attrFormDefault; + } + + public void setAttrFormDefault(String attrFormDefault) { + this.attrFormDefault = attrFormDefault; + } + + public String getElementFormDefault() { + if ( elementFormDefault == null ) + { + elementFormDefault = FORM_DEFAULT_QUALIFIED; + } + return elementFormDefault; + } + + public void setElementFormDefault(String elementFormDefault) { + this.elementFormDefault = elementFormDefault; + } + + public ArrayList getExtraClasses() { + return extraClasses; + } + + public void setExtraClasses(ArrayList extraClasses) { + this.extraClasses = extraClasses; + } +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java new file mode 100644 index 0000000000..8855c3f6e9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser; + +/** + * This class provides the tooling abstraction to Tuscany Java2WSDL and can be + * invoked from command line with the follwing options as with Axis2 Java2WSDL + * + */ +public class Java2WSDL { + /** + * @param args + */ + public static void main(String[] args) + { + //parse the cmd line args + Java2WSDLCommandLineOptionParser commandLineOptionParser = + new Java2WSDLCommandLineOptionParser(args); + // validate the arguments + validateCommandLineOptions(commandLineOptionParser); + + Java2WSDLGeneratorFactory.getInstance().createGenerator(). + generateWSDL(commandLineOptionParser.getAllOptions()); + + // Uncomment the following statement to directly run the Axis2 tool + // without + // runAxis2Tool(args); + } + + private static void runAxis2Tool(String[] args) { + org.apache.ws.java2wsdl.Java2WSDL.main(args); + } + + private static void validateCommandLineOptions(Java2WSDLCommandLineOptionParser parser) { + if (parser.getAllOptions().size() == 0) { + printUsage(); + } else if (parser.getInvalidOptions(new TuscanyJava2WSDLOptionsValidator()).size() > 0) { + printUsage(); + } + + } + + public static void printUsage() { + System.out.println("Usage java2wsdl -cn : class file name"); + System.out.println("-o : output file location"); + System.out.println("-cp : list of classpath entries - (urls)"); + System.out.println("-tn : target namespace"); + System.out.println("-tp : target namespace prefix"); + System.out.println("-stn : target namespace for schema"); + System.out.println("-stp : target namespace prefix for schema"); + System.out.println("-sn : service name"); + System.out.println("-of : output file name for the WSDL"); + System.out.println("-st : style for the WSDL"); + System.out.println("-u : use for the WSDL"); + System.out.println("-l : address of the port for the WSDL"); + System.out.println("-ixsd [, ] : schemas to be imported (and not generated)"); + System.out.println("-efd : Setting for elementFormDefault (defaults to qualified)"); + System.out.println("-afd : Setting for attributeFormDefault (defaults to qualified)"); + System.out.println("-xc : Extra class for which schematype must be generated. " + + "\t\tUse as : -xc class1 -xc class2 ..."); + System.exit(0); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java new file mode 100644 index 0000000000..3323113af4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.Map; + +/** + * This is the Java2WSDL Generator facade that will be used by Tuscany + * components for java to wsdl conversion. + * + */ +public interface Java2WSDLGenerator { + public void generateWSDL(String[] args); + + public void generateWSDL(Map commandLineOptions); + + public void addWSDLGenListener(WSDLGenListener l); + + public void removeWSDLGenListener(WSDLGenListener l); + + public Map getCommandLineOptions(); + + public void setCommandLineOptoins(Map cmdLineOpts); + + public OutputStream getOutputStream(); + + public void setOutputStream(OutputStream outStream); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java new file mode 100644 index 0000000000..e8f3db95b0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.Vector; + +/** + * Factory that creates Java2WSDL Generators. Presently the there is a Default + * Generator that wraps around the AXIS2 Java2WSDL implementation. The factory + * can be extended to create generators that wrap around other implementations + * if required. + */ + +public class Java2WSDLGeneratorFactory { + /* + * singleton instance of this factory class + */ + private static Java2WSDLGeneratorFactory factory = null; + + /** + * code for the default generator + */ + public static final int DEFAULT_GENERATOR = 0; + + /** + * Default Generator class name + */ + public static final String DEFAULT_GENERATOR_CLASSNAME = "org.apache.tuscany.tools.java2wsdl.generate.Java2WSDLGeneratorImpl"; + + /** + * list of generator classnames in a position that corresponds to their + * code. For example the default generator's code is 0 and hence this + * generator's classname is stored at index '0' of the list + */ + protected Vector generatorClassNames = new Vector(); + + /** + * @return the singleton instance of this generator factory + */ + public static Java2WSDLGeneratorFactory getInstance() { + if (factory == null) { + factory = new Java2WSDLGeneratorFactory(); + } + return factory; + } + + private Java2WSDLGeneratorFactory() { + generatorClassNames.addElement(DEFAULT_GENERATOR_CLASSNAME); + } + + public Java2WSDLGenerator createGenerator() { + return createGenerator(DEFAULT_GENERATOR); + } + + /** + * creates an instance of a Java2WSDL Generator based on the input type + * + * @param genType + * type of the generator to be created + * @return an instance of a Java2WSDL Generator + */ + public Java2WSDLGenerator createGenerator(int genType) { + try { + return (Java2WSDLGenerator) (Class.forName(generatorClassNames + .elementAt(genType)).newInstance()); + } catch (Exception e) { + System.out + .println(" Unable to create Java2WSDL generator due to ....."); + System.out.println(e); + return null; + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java new file mode 100644 index 0000000000..9d1a9df438 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java @@ -0,0 +1,239 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import org.apache.ws.java2wsdl.Java2WSDL; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser; +import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator; + +/** + * This is an implementation of the Java2WSDLGenerator facade. This + * implementation is a decorator around the Axis2 implementation of the + * Java2WSDL conversion. The WSDL generation is divided into phases that are + * stringed up as a template method. The phases are - User Input Validation - + * WSDL Java Model Generation - Serialization of WSDL Java Model The function of + * each phase is accomplished by delegation to the appropriate classes in Axis2. + * At the start and end of each phase an event is published to subcribers + * denoting the start and end of the phase. + * + * Such a spliting up of the Java2WSDL conversion into phases has been designed + * to enable interceptors to modify the model or apply transformations to the + * output. Typically the interceptors can subscribe to the start and end events + * of these phases and hence be able to intercept. + * + * Note: This class contains substantial AXIS2 Java2WSDL code refactored into + * it. These will be removed as and when the Axis2 code is fixed. + * + */ +public class Java2WSDLGeneratorImpl implements Java2WSDLGenerator, TuscanyJava2WSDLConstants +{ + private List genPhaseListeners = new Vector(); + private GenerationParameters genParams = null; + private Map commandLineOptions = null; + private TuscanyJava2WSDLBuilder java2WsdlBuilder; + private OutputStream outputStream = null; + + public Java2WSDLGeneratorImpl() + { + + } + + private void multicastGenPhaseCompletionEvent(int genPhase) { + WSDLGenEvent event = new WSDLGenEvent(this, genPhase); + Iterator iterator = genPhaseListeners.iterator(); + while (iterator.hasNext()) { + ((WSDLGenListener) iterator.next()).WSDLGenPhaseCompleted(event); + } + } + + private void initJava2WSDLBuilder() throws Exception + { +// Now we are done with loading the basic values - time to create the builder + java2WsdlBuilder = new TuscanyJava2WSDLBuilder(genParams); + } + + protected boolean validateInputArgs(String[] args) + { + boolean isValid = true; + Java2WSDLCommandLineOptionParser parser = new Java2WSDLCommandLineOptionParser(args); + if (parser.getAllOptions().size() == 0) { + Java2WSDL.printUsage(); + isValid = false; + } else if (parser.getInvalidOptions(new Java2WSDLOptionsValidator()) + .size() > 0) { + Java2WSDL.printUsage(); + isValid = false; + } + + if (isValid) + { + commandLineOptions = parser.getAllOptions(); + } + + return isValid; + } + + public boolean buildWSDLDocument() throws Exception + { + boolean isComplete = true; + initJava2WSDLBuilder(); + java2WsdlBuilder.buildWSDL(); + + return isComplete; + } + + public boolean serializeWSDLDocument() throws Exception { + boolean isComplete = true; + + if ( getOutputStream() == null ) + { + setOutputStream(genParams.getOutputFileStream()); + } + + java2WsdlBuilder.getWsdlDocument().serialize(getOutputStream()); + getOutputStream().flush(); + getOutputStream().close();; + + return isComplete; + } + + /* + * This is the template method that splits the Java2WSDL generation cycle + * into phase / steps. + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#generateWSDL(java.lang.String[]) + */ + public void generateWSDL(Map commandLineOptions) + { + try + { + // load the user options into an easy to access abstraction + genParams = new GenerationParameters(commandLineOptions); + + // if the WSDL Model generation was successul + if ( buildWSDLDocument() ) + { + // multicast event for generation of wsdl model + multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_CREATION); + // if the serialization of the generated (and fixed) model + // is successful + if (serializeWSDLDocument()) { + // multicast event for writing of the WSDL Model to + // supplied output stream + multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_WRITING); + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + + // TODO Auto-generated method stub + + } + + public void generateWSDL(String[] args) + { + // if the argument input are found to be valid + if (validateInputArgs(args)) + { + //multicast event for input args validation complete + multicastGenPhaseCompletionEvent(WSDLGenListener.INPUT_ARGS_VALIDATION); + generateWSDL(commandLineOptions); + } + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#addWSDLGenListener(tuscany.tools.WSDLGenListener) + */ + public void addWSDLGenListener(WSDLGenListener l) { + genPhaseListeners.add(l); + + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#removeWSDLGenListener(tuscany.tools.WSDLGenListener) + */ + public void removeWSDLGenListener(WSDLGenListener l) { + genPhaseListeners.remove(l); + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#getCommandLineOptions() + */ + public Map getCommandLineOptions() { + return commandLineOptions; + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#setCommandLineOptoins(java.util.Map) + */ + public void setCommandLineOptoins(Map cmdLineOpts) { + commandLineOptions = cmdLineOpts; + } + + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#getOutputStream() + */ + public OutputStream getOutputStream() { + // TODO Auto-generated method stub + return outputStream; + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#setOutputStream(java.io.OutputStream) + */ + public void setOutputStream(OutputStream outStream) { + outputStream = outStream; + } + + + public TuscanyJava2WSDLBuilder getJava2WsdlBuilder() + { + return java2WsdlBuilder; + } + + public void setJava2WsdlBuilder(TuscanyJava2WSDLBuilder java2WsdlBuilder) + { + this.java2WsdlBuilder = java2WsdlBuilder; + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java new file mode 100644 index 0000000000..67609445ae --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java @@ -0,0 +1,524 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.StringReader; +import java.lang.reflect.Constructor; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Vector; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sdo.util.SDOUtil; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaForm; +import org.apache.ws.commons.schema.XmlSchemaGroupBase; +import org.apache.ws.commons.schema.XmlSchemaImport; +import org.apache.ws.commons.schema.XmlSchemaInclude; +import org.apache.ws.commons.schema.XmlSchemaSequence; +import org.apache.ws.commons.schema.XmlSchemaType; +import org.apache.ws.commons.schema.utils.NamespaceMap; +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.codehaus.jam.JClass; +import org.codehaus.jam.JProperty; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.XSDHelper; + +public class SchemaBuilder implements TuscanyJava2WSDLConstants { + public static final String NAME_SPACE_PREFIX = "stn_"; + + private static int prefixCount = 1; + + public static final String MIXED = "mixed"; + + public static final String GROUP = "group"; + + protected String attrFormDefault = null; + + protected String elementFormDefault = null; + + protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); + + private Hashtable schemaMap = new Hashtable(); + + protected Hashtable targetNamespacePrefixMap = new Hashtable(); + + protected TuscanyTypeTable typeTable = new TuscanyTypeTable(); + + protected Map schemaLocationMap = null; + + private ClassLoader classLoader; + + protected SchemaBuilder(XmlSchemaCollection schemaCollection, + Hashtable schemaMap, + Hashtable nsPrefixMap, + TuscanyTypeTable typeTable, + String attrFormDef, + String eleFormDef, + Map schemaLocMap, + ClassLoader classLoader) { + this.schemaMap = schemaMap; + this.xmlSchemaCollection = schemaCollection; + this.targetNamespacePrefixMap = nsPrefixMap; + this.typeTable = typeTable; + this.schemaLocationMap = schemaLocMap; + this.classLoader = classLoader; + this.attrFormDefault = attrFormDef; + this.elementFormDefault = eleFormDef; + } + + private boolean isSDO(JClass javaType) throws Exception { + Class sdoClass = Class.forName(javaType.getQualifiedName(), + true, + classLoader); + return DataObject.class.isAssignableFrom(sdoClass); + } + + private void buildComplexTypeContents_JavaType(JClass javaType, + XmlSchemaComplexType complexType, + XmlSchema xmlSchema) throws Exception { + JProperty[] properties = javaType.getDeclaredProperties(); + + for (int i = 0; i < properties.length; i++) { + JProperty property = properties[i]; + String propertyName = property.getType().getQualifiedName(); + boolean isArryType = property.getType().isArrayType(); + if (isArryType) { + propertyName = property.getType().getArrayComponentType().getQualifiedName(); + } + + if (typeTable.isSimpleType(propertyName)) { + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(getCorrectName(property.getSimpleName())); + elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyName)); + ((XmlSchemaGroupBase) complexType.getParticle()).getItems().add(elt1); + if (isArryType) { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + } else { + QName schemaTypeName = null; + if (isArryType) { + schemaTypeName = generateSchema(property.getType().getArrayComponentType()); + } else { + schemaTypeName = generateSchema(property.getType()); + } + + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(getCorrectName(property.getSimpleName())); + elt1.setSchemaTypeName(schemaTypeName); + ((XmlSchemaGroupBase) complexType.getParticle()).getItems().add(elt1); + + if (isArryType) { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + + addImports(xmlSchema, + schemaTypeName); + } + } + } + + protected QName buildSchema_JavaType(JClass javaType) throws Exception { + QName schemaTypeName = typeTable.getComplexSchemaTypeName(javaType, this.classLoader); + if (schemaTypeName == null) { + String simpleName = javaType.getSimpleName(); + + String packageName = javaType.getContainingPackage().getQualifiedName(); + + String targetNameSpace = + Java2WSDLUtils.schemaNamespaceFromClassName(javaType.getQualifiedName(), this.classLoader) + .toString(); + + XmlSchema xmlSchema = getXmlSchema(targetNameSpace); + String targetNamespacePrefix = (String) targetNamespacePrefixMap.get(targetNameSpace); + + schemaTypeName = new QName(targetNameSpace, simpleName, targetNamespacePrefix); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); + complexType.setName(simpleName); + + XmlSchemaSequence sequence = new XmlSchemaSequence(); + complexType.setParticle(sequence); + + createGlobalElement(xmlSchema, + complexType, + schemaTypeName); + xmlSchema.getItems().add(complexType); + xmlSchema.getSchemaTypes().add(schemaTypeName, + complexType); + + // adding this type to the table + // typeTable.addComplexScheam(name, complexType.getQName()); + typeTable.addComplexSchemaType(targetNameSpace, + simpleName, + schemaTypeName); + buildComplexTypeContents_JavaType(javaType, + complexType, + xmlSchema); + } + return schemaTypeName; + } + + protected QName buildSchema_SDO(Type dataType) // throws Exception + { + QName schemaTypeName = typeTable.getComplexSchemaTypeName(dataType.getURI(), + dataType.getName()); + + if (schemaTypeName == null) { + // invoke XSDHelper to generate schema for this sdo type + XSDHelper xsdHelper = SDOUtil.createXSDHelper(SDOUtil.createTypeHelper()); + // it is better to check if XSDHelper can generate the schema + if (xsdHelper.isXSD(dataType)) { + // if schemalocations for xsd has been specified, include them + includeExtXSD(dataType); + } else { + List typeList = new Vector(); + typeList.add(dataType); + + // the xsdhelper returns a string that contains the schemas for this type + String schemaDefns = xsdHelper.generate(typeList, + schemaLocationMap); + + // extract the schema elements and store them in the schema map + extractSchemas(schemaDefns); + } + // since the XSDHelper will not return the type name, create it and store it in typetable + schemaTypeName = new QName(dataType.getURI(), dataType.getName(), generatePrefix()); + typeTable.addComplexSchemaType(dataType.getURI(), + dataType.getName(), + schemaTypeName); + + } + return schemaTypeName; + } + + public QName generateSchema(JClass javaType) throws Exception { + if (isSDO(javaType)) { + Type dataType = createDataObject(javaType).getType(); + return buildSchema_SDO(dataType); + } else { + return buildSchema_JavaType(javaType); + } + } + + private XmlSchema getXmlSchema(String targetNamespace) { + XmlSchema xmlSchema; + + if ((xmlSchema = (XmlSchema) schemaMap.get(targetNamespace)) == null) { + String targetNamespacePrefix = generatePrefix(); + + xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); + xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); + + targetNamespacePrefixMap.put(targetNamespace, + targetNamespacePrefix); + schemaMap.put(targetNamespace, + xmlSchema); + + NamespaceMap prefixmap = new NamespaceMap(); + prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, + TuscanyTypeTable.XML_SCHEMA_URI); + prefixmap.put(targetNamespacePrefix, + targetNamespace); + xmlSchema.setNamespaceContext(prefixmap); + } + return xmlSchema; + } + + /** + * JAM convert first name of an attribute into UpperCase as an example if there is a instance variable called foo in a bean , then Jam give that + * as Foo so this method is to correct that error + * + * @param wrongName + * @return the right name, using english as the locale for case conversion + */ + public static String getCorrectName(String wrongName) { + if (wrongName.length() > 1) { + return wrongName.substring(0, + 1).toLowerCase(Locale.ENGLISH) + + wrongName.substring(1, + wrongName.length()); + } else { + return wrongName.substring(0, + 1).toLowerCase(Locale.ENGLISH); + } + } + + private String addImports(XmlSchema xmlSchema, QName schemaTypeName) { + String prefix = null; + String[] prefixes = xmlSchema.getNamespaceContext().getDeclaredPrefixes(); + for (int count = 0; count < prefixes.length; ++count) { + if (schemaTypeName.getNamespaceURI(). + equals(xmlSchema.getNamespaceContext().getNamespaceURI(prefixes[count])) ) { + return prefixes[count]; + } + } + + // the following lines are executed only if a prefix was not found which implies that the + // schemaTypeName was not imported earlier and also it does not belong to the targetnamespace + String schemaLocation = null; + XmlSchemaImport importElement = new XmlSchemaImport(); + importElement.setNamespace(schemaTypeName.getNamespaceURI()); + xmlSchema.getItems().add(importElement); + prefix = generatePrefix(); + //it is safe to cast like this since it was this class that instantiated the + //NamespaceContext and assigned it to an instance of a NamespaceMap (see method getXmlSchema) + ((NamespaceMap)xmlSchema.getNamespaceContext()).put(prefix, + schemaTypeName.getNamespaceURI()); + + return prefix; + } + + private String formGlobalElementName(String typeName) { + String firstChar = typeName.substring(0, + 1); + return typeName.replaceFirst(firstChar, + firstChar.toLowerCase()); + } + + private void createGlobalElement(XmlSchema xmlSchema, + XmlSchemaComplexType complexType, + QName elementName) { + XmlSchemaElement globalElement = new XmlSchemaElement(); + globalElement.setSchemaTypeName(complexType.getQName()); + globalElement.setName(formGlobalElementName(complexType.getName())); + globalElement.setQName(elementName); + + xmlSchema.getItems().add(globalElement); + xmlSchema.getElements().add(elementName, + globalElement); + } + + private DataObject createDataObject(JClass sdoClass) throws Exception { + Class sdoType = Class.forName(sdoClass.getQualifiedName(), + true, + classLoader); + + Constructor constructor = sdoType.getDeclaredConstructor(new Class[0]); + constructor.setAccessible(true); + Object instance = constructor.newInstance(new Object[0]); + return (DataObject) instance; + } + + private String generatePrefix() { + return NAME_SPACE_PREFIX + prefixCount++; + } + + private void includeExtXSD(Type dataType) { + // now we know there is a type for which the xsd must come from outside + // create a schema for the namespace of this type and add an include in it for + // the xsd that is defined externally + XmlSchema xmlSchema = getXmlSchema(dataType.getURI()); + + // ideally there could be more than one external schema defintions for a namespace + // and hence schemalocations will be a list of locations + // List schemaLocations = (List)schemaLocationMap.get(dataType.getURI()); + + // since as per the specs the input to XSDHelper is a map of allowing + // only one schemalocation for a namespace. So for now this single location will be + // picked up and put into a list + List schemaLocations = new Vector(); + + if (schemaLocationMap.get(dataType.getURI()) != null) { + schemaLocations.add(schemaLocationMap.get(dataType.getURI())); + } + + if (schemaLocations.size() <= 0) { + schemaLocations.add(DEFAULT_SCHEMA_LOCATION); + } + + Iterator includesIterator = xmlSchema.getIncludes().getIterator(); + Iterator schemaLocIterator = schemaLocations.iterator(); + String aSchemaLocation = null; + boolean includeExists = false; + // include all external schema locations + while (schemaLocIterator.hasNext()) { + aSchemaLocation = (String) schemaLocIterator.next(); + while (includesIterator.hasNext()) { + if (!includeExists + && aSchemaLocation.equals(((XmlSchemaInclude) includesIterator.next()).getSchemaLocation())) { + includeExists = true; + } + } + + if (!includeExists) { + XmlSchemaInclude includeElement = new XmlSchemaInclude(); + includeElement.setSchemaLocation(aSchemaLocation); + xmlSchema.getIncludes().add(includeElement); + xmlSchema.getItems().add(includeElement); + } + } + + } + + private void extractSchemas(String schemaDefns) { + // load each schema element and add it to the schema map + + String token = getToken(schemaDefns); + int curIndex = schemaDefns.indexOf(token); + int nextIndex = schemaDefns.indexOf(token, + curIndex + token.length()); + + while (curIndex != -1) { + StringReader sr = null; + if (nextIndex != -1) + sr = new StringReader(schemaDefns.substring(curIndex, + nextIndex)); + else + sr = new StringReader(schemaDefns.substring(curIndex)); + + XmlSchemaCollection collection = new XmlSchemaCollection(); + XmlSchema aSchema = collection.read(sr, + null); + addSchemaToMap(aSchema); + + curIndex = nextIndex; + nextIndex = schemaDefns.indexOf(token, + curIndex + token.length()); + } + } + + private void addSchemaToMap(XmlSchema extractedSchema) { + // check if a Schema object already exists in schema map for targetNamespace of this schema element + // if it does then copy the contents of this schema element to the existing one, ensuring that + // duplicate elements are not created. i.e. before adding some child element like 'include' or 'import' + // check if it already exists, if it does don't add this + XmlSchema existingSchema = (XmlSchema) schemaMap.get(extractedSchema.getTargetNamespace()); + + if (existingSchema == null) { + extractedSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + extractedSchema.setElementFormDefault(getElementFormDefaultSetting()); + schemaMap.put(extractedSchema.getTargetNamespace(), + extractedSchema); + + } else { + copySchemaItems(existingSchema, + extractedSchema); + } + } + + private void copySchemaItems(XmlSchema existingSchema, XmlSchema aSchema) { + // items to copy are imports, includes, elements, types ... + // each item is checked if it is a duplicate entry and copied only if it isn't + Iterator itemsIterator = aSchema.getItems().getIterator(); + Object schemaObject = null; + XmlSchemaElement schemaElement = null; + XmlSchemaType schemaType = null; + XmlSchemaInclude schemaInclude = null; + QName qName = null; + List existingIncludes = getExistingIncludes(existingSchema); + + while (itemsIterator.hasNext()) { + schemaObject = itemsIterator.next(); + if (schemaObject instanceof XmlSchemaElement) { + schemaElement = (XmlSchemaElement) schemaObject; + qName = schemaElement.getQName(); + // if the element does not exist in the existing schema + if (existingSchema.getElementByName(qName) == null) { + // add it to the existing schema + existingSchema.getElements().add(qName, + schemaElement); + existingSchema.getItems().add(schemaElement); + } + } else if (schemaObject instanceof XmlSchemaType) { + schemaType = (XmlSchemaType) itemsIterator.next(); + qName = schemaType.getQName(); + // if the element does not exist in the existing schema + if (existingSchema.getElementByName(qName) == null) { + // add it to the existing schema + existingSchema.getSchemaTypes().add(qName, + schemaType); + existingSchema.getItems().add(schemaType); + // add imports + addImports(existingSchema, + qName); + } + } else if (schemaObject instanceof XmlSchemaInclude) { + schemaInclude = (XmlSchemaInclude) itemsIterator.next(); + if (!existingIncludes.contains(schemaInclude.getSchemaLocation())) { + existingSchema.getIncludes().add(schemaInclude); + existingSchema.getItems().add(schemaInclude); + } + } + } + } + + private List getExistingIncludes(XmlSchema xmlSchema) { + List includeSchemaLocations = new Vector(); + Iterator iterator = xmlSchema.getIncludes().getIterator(); + + while (iterator.hasNext()) { + includeSchemaLocations.add(((XmlSchemaInclude) iterator.next()).getSchemaLocation()); + } + return includeSchemaLocations; + } + + private XmlSchemaForm getAttrFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private XmlSchemaForm getElementFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private String getToken(String s) { + // get the schema element name eg. "); + writeSchemas(writer); + writer.write(""); + + XMLStreamReader xmlReader = XMLInputFactory.newInstance() + .createXMLStreamReader(new ByteArrayInputStream(writer.toString() + .getBytes())); + + StAXOMBuilder staxOMBuilders = new StAXOMBuilder(fac, xmlReader); + OMElement documentElement = staxOMBuilders.getDocumentElement(); + + + Iterator iterator = documentElement.getChildElements(); + while (iterator.hasNext()) { + wsdlTypes.addChild((OMNode) iterator.next()); + } + defintions.addChild(wsdlTypes); + } + + private void writeSchemas(StringWriter writer) { + Iterator iterator = schemaCollection.iterator(); + XmlSchema xmlSchema = null; + + while (iterator.hasNext()) { + xmlSchema = (XmlSchema) iterator.next(); + // typeIterator = xmlSchema.getSchemaTypes().getValues(); + /* + * while (typeIterator.hasNext()) { xmlSchema.getItems().add((XmlSchemaObject) typeIterator.next()); } + */ + xmlSchema.write(writer); + } + } + + private void generateMessages(OMFactory fac, OMElement definitions) throws Exception { + Hashtable namespaceMap = new Hashtable(); + String namespacePrefix = null; + String namespaceURI = null; + QName messagePartType = null; + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + + if (jmethod.isPublic()) { + // Request Message + OMElement requestMessge = fac.createOMElement(MESSAGE_LOCAL_NAME, + wsdl); + requestMessge.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName() + MESSAGE_SUFFIX, + null); + definitions.addChild(requestMessge); + + // only if a type for the message part has already been defined + if ((messagePartType = typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(), + jmethod.getSimpleName())) != null) { + namespaceURI = messagePartType.getNamespaceURI(); + // avoid duplicate namespaces + if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) { + namespacePrefix = generatePrefix(); + namespaceMap.put(namespaceURI, + namespacePrefix); + } + + OMElement requestPart = fac.createOMElement(PART_ATTRIBUTE_NAME, + wsdl); + requestMessge.addChild(requestPart); + requestPart.addAttribute(ATTRIBUTE_NAME, + "part1", + null); + + requestPart.addAttribute(ELEMENT_ATTRIBUTE_NAME, + namespacePrefix + COLON_SEPARATOR + + jmethod.getSimpleName(), + null); + } + + // only if a type for the message part has already been defined + if ((messagePartType = typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(), + jmethod.getSimpleName() + + RESPONSE)) != null) { + namespaceURI = messagePartType.getNamespaceURI(); + if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) { + namespacePrefix = generatePrefix(); + namespaceMap.put(namespaceURI, + namespacePrefix); + } + // Response Message + OMElement responseMessge = fac.createOMElement(MESSAGE_LOCAL_NAME, + wsdl); + responseMessge.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName() + RESPONSE_MESSAGE, + null); + definitions.addChild(responseMessge); + OMElement responsePart = fac.createOMElement(PART_ATTRIBUTE_NAME, + wsdl); + responseMessge.addChild(responsePart); + responsePart.addAttribute(ATTRIBUTE_NAME, + "part1", + null); + + responsePart.addAttribute(ELEMENT_ATTRIBUTE_NAME, + namespacePrefix + COLON_SEPARATOR + + jmethod.getSimpleName() + RESPONSE, + null); + } + } + } + + // now add these unique namespaces to the the definitions element + Enumeration enumeration = namespaceMap.keys(); + while (enumeration.hasMoreElements()) { + namespaceURI = (String) enumeration.nextElement(); + definitions.declareNamespace(namespaceURI, + (String) namespaceMap.get(namespaceURI)); + } + } + + /** + * Generate the porttypes + */ + private void generatePortType(OMFactory fac, OMElement defintions) { + JMethod jmethod = null; + OMElement operation = null; + OMElement message = null; + OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, + wsdl); + defintions.addChild(portType); + portType.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + PORT_TYPE_SUFFIX, + null); + // adding message refs + for (int i = 0; i < method.length; i++) { + jmethod = method[i]; + + if (jmethod.isPublic()) { + operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + portType.addChild(operation); + operation.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName(), + null); + + message = fac.createOMElement(IN_PUT_LOCAL_NAME, + wsdl); + message.addAttribute(MESSAGE_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + jmethod.getSimpleName() + + MESSAGE_SUFFIX, + null); + operation.addChild(message); + + if (!jmethod.getReturnType().isVoidType()) { + message = fac.createOMElement(OUT_PUT_LOCAL_NAME, + wsdl); + message.addAttribute(MESSAGE_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + + jmethod.getSimpleName() + RESPONSE_MESSAGE, + null); + operation.addChild(message); + } + } + } + + } + + /** + * Generate the service + */ + public void generateService(OMFactory fac, OMElement defintions) { + OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME, + wsdl); + defintions.addChild(service); + service.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName(), + null); + OMElement port = fac.createOMElement(PORT, + wsdl); + service.addChild(port); + port.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + SOAP11PORT, + null); + port.addAttribute(BINDING_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + BINDING_NAME_SUFFIX, + null); + addExtensionElement(fac, + port, + soap, + SOAP_ADDRESS, + LOCATION, + generationParams.getLocationUri() + generationParams.getServiceName()); + + port = fac.createOMElement(PORT, + wsdl); + service.addChild(port); + port.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + SOAP12PORT, + null); + port.addAttribute(BINDING_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + SOAP12BINDING_NAME_SUFFIX, + null); + addExtensionElement(fac, + port, + soap12, + SOAP_ADDRESS, + LOCATION, + generationParams.getLocationUri() + generationParams.getServiceName()); + } + + /** + * Generate the bindings + */ + private void generateBinding(OMFactory fac, OMElement defintions) throws Exception { + generateSoap11Binding(fac, + defintions); + generateSoap12Binding(fac, + defintions); + } + + private void generateSoap11Binding(OMFactory fac, OMElement defintions) throws Exception { + OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, + wsdl); + defintions.addChild(binding); + binding.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + BINDING_NAME_SUFFIX, + null); + binding.addAttribute("type", + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + PORT_TYPE_SUFFIX, + null); + + addExtensionElement(fac, + binding, + soap, + BINDING_LOCAL_NAME, + TRANSPORT, + TRANSPORT_URI, + STYLE, + generationParams.getStyle()); + + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + if (jmethod.isPublic()) { + OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + binding.addChild(operation); + + addExtensionElement(fac, + operation, + soap, + OPERATION_LOCAL_NAME, + SOAP_ACTION, + URN_PREFIX + COLON_SEPARATOR + jmethod.getSimpleName(), + STYLE, + generationParams.getStyle()); + operation.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName(), + null); + + OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + input, + soap, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(input); + + if (!jmethod.getReturnType().isVoidType()) { + OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + output, + soap, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(output); + } + } + } + } + + private void generateSoap12Binding(OMFactory fac, OMElement defintions) throws Exception { + OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, + wsdl); + defintions.addChild(binding); + binding.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + SOAP12BINDING_NAME_SUFFIX, + null); + binding.addAttribute("type", + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + PORT_TYPE_SUFFIX, + null); + + addExtensionElement(fac, + binding, + soap12, + BINDING_LOCAL_NAME, + TRANSPORT, + TRANSPORT_URI, + STYLE, + generationParams.getStyle()); + + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + + if (jmethod.isPublic()) { + OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + binding.addChild(operation); + operation.declareNamespace(URI_WSDL12_SOAP, + SOAP12_PREFIX); + + addExtensionElement(fac, + operation, + soap12, + OPERATION_LOCAL_NAME, + SOAP_ACTION, + URN_PREFIX + COLON_SEPARATOR + jmethod.getSimpleName(), + STYLE, + generationParams.getStyle()); + operation.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName(), + null); + + OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + input, + soap12, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(input); + + if (!jmethod.getReturnType().isVoidType()) { + OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + output, + soap12, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(output); + } + } + } + } + + private void addExtensionElement(OMFactory fac, + OMElement element, + OMNamespace namespace, + String name, + String att1Name, + String att1Value, + String att2Name, + String att2Value) { + OMElement soapbinding = fac.createOMElement(name, + namespace); + element.addChild(soapbinding); + soapbinding.addAttribute(att1Name, + att1Value, + null); + soapbinding.addAttribute(att2Name, + att2Value, + null); + } + + private void addExtensionElement(OMFactory fac, + OMElement element, + OMNamespace namespace, + String name, + String att1Name, + String att1Value) { + OMElement soapbinding = fac.createOMElement(name, + namespace); + element.addChild(soapbinding); + soapbinding.addAttribute(att1Name, + att1Value, + null); + } + + private String generatePrefix() { + return NAMESPACE_PREFIX + prefixCount++; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java new file mode 100644 index 0000000000..b23726f6fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Collection; + +import org.apache.axiom.om.OMElement; +import org.apache.ws.java2wsdl.Java2WSDLConstants; + +public class TuscanyJava2WSDLBuilder implements Java2WSDLConstants { + + private OutputStream out; + private String className; + private ClassLoader classLoader; + private String wsdlPrefix = "wsdl"; + + // these apply for the WSDL + private GenerationParameters generationParams; + + private OMElement wsdlDocument = null; + + public String getWsdlPrefix() { + return wsdlPrefix; + } + + public void setWsdlPrefix(String wsdlPrefix) { + this.wsdlPrefix = wsdlPrefix; + } + + public TuscanyJava2WSDLBuilder(GenerationParameters genParams) { + this.generationParams = genParams; + } + + /** + * Externally visible generator method + * + * @throws Exception + */ + public void buildWSDL() throws Exception { + ArrayList excludeOpeartion = new ArrayList(); + excludeOpeartion.add("init"); + excludeOpeartion.add("setOperationContext"); + excludeOpeartion.add("destroy"); + + TuscanyWSDLTypesGenerator typesGenerator = new TuscanyWSDLTypesGenerator(generationParams); + typesGenerator.setExcludeMethods(excludeOpeartion); + Collection schemaCollection = typesGenerator.buildWSDLTypes(); + + TuscanyJava2OMBuilder java2OMBuilder = + new TuscanyJava2OMBuilder(typesGenerator.getMethods(), schemaCollection, typesGenerator + .getTypeTable(), generationParams); + + wsdlDocument = java2OMBuilder.generateOM(); + } + + public OMElement getWsdlDocument() { + return wsdlDocument; + } + + public void setWsdlDocument(OMElement wsdlDocument) { + this.wsdlDocument = wsdlDocument; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java new file mode 100644 index 0000000000..cde870fff4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import org.apache.ws.java2wsdl.Java2WSDLConstants; + +/** + * This is a extension from the Axis2 Java2WSDLConstants to handle additions specific to Tuscany. + * This class can be done away with once Axis2 is also enhanced to support these + * additional options. + * + */ +public interface TuscanyJava2WSDLConstants extends Java2WSDLConstants +{ + public static final char OPEN_BRACKET = '['; + public static final char COMMA = ','; + public static final char CLOSE_BRACKET = ']'; + public static final String DEFAULT_SCHEMA_LOCATION = "*.xsd"; + public static final String SCHEMA_ELEMENT_NAME = "schema"; + + String FORM_DEFAULT_QUALIFIED = "qualified"; + String FORM_DEFAULT_UNQUALIFIED = "unqualified"; + + //short options + String IMPORT_XSD_OPTION = "ixsd"; //option for importing XSDs + String ATTR_FORM_DEFAULT_OPTION = "afd"; + String ELEMENT_FORM_DEFAULT_OPTION = "efd"; + String EXTRA_CLASSES_DEFAULT_OPTION = "xc"; + + //long options + String IMPORT_XSD_OPTION_LONG = "import_xsd"; //option for importing XSDs + String ATTR_FORM_DEFAULT_OPTION_LONG = "attributeFormDefault"; + String ELEMENT_FORM_DEFAULT_OPTION_LONG = "elementFormDefault"; + String EXTRA_CLASSES_DEFAULT_OPTION_LONG = "extraClasses"; +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java new file mode 100644 index 0000000000..6411327abf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.ArrayList; + +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; +import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator; + +/** + * This class is an extension from the Axis2 implementation in order to handle additional optoins + * specific to Tuscany. This class can be done away with once Axis2 is also enhanced to support these + * additional options. + * + */ +public class TuscanyJava2WSDLOptionsValidator extends Java2WSDLOptionsValidator implements + TuscanyJava2WSDLConstants { + public boolean isInvalid(Java2WSDLCommandLineOption option) { + boolean invalid; + String optionType = option.getOptionType(); + + invalid = !((IMPORT_XSD_OPTION).equalsIgnoreCase(optionType) + || (IMPORT_XSD_OPTION_LONG).equalsIgnoreCase(optionType) + || (TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION_LONG).equalsIgnoreCase(optionType) + || (TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION).equalsIgnoreCase(optionType) + || !super.isInvalid(option)); + + invalid = validateImportXSDOption(invalid, + option); + + return invalid; + } + + private boolean validateImportXSDOption(boolean invalid, Java2WSDLCommandLineOption option) { + String optionType = option.getOptionType(); + String schemaNSLocationPair = null; + + if (!invalid && (IMPORT_XSD_OPTION).equalsIgnoreCase(optionType) + || (IMPORT_XSD_OPTION_LONG).equalsIgnoreCase(optionType)) { + ArrayList optionValues = option.getOptionValues(); + + for (int count = 0; count < optionValues.size(); ++count) { + schemaNSLocationPair = ((String) optionValues.get(count)).trim(); + if ((schemaNSLocationPair.charAt(0) != OPEN_BRACKET) + || (schemaNSLocationPair.charAt(schemaNSLocationPair.length() - 1) != CLOSE_BRACKET) + || (schemaNSLocationPair.indexOf(COMMA) == -1)) + + { + System.out.println("Schema Namespace-Location pair option not specified properly!!"); + invalid = true; + } + } + } + + return invalid; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java new file mode 100644 index 0000000000..4f3371126d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java @@ -0,0 +1,410 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaForm; +import org.apache.ws.commons.schema.XmlSchemaImport; +import org.apache.ws.commons.schema.XmlSchemaInclude; +import org.apache.ws.commons.schema.XmlSchemaSequence; +import org.apache.ws.commons.schema.utils.NamespaceMap; +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.SchemaGenerator; +import org.apache.ws.java2wsdl.bytecode.MethodTable; +import org.codehaus.jam.JClass; +import org.codehaus.jam.JMethod; +import org.codehaus.jam.JParameter; +import org.codehaus.jam.JamClassIterator; +import org.codehaus.jam.JamService; +import org.codehaus.jam.JamServiceFactory; +import org.codehaus.jam.JamServiceParams; + + +public class TuscanySchemaGenerator implements TuscanyJava2WSDLConstants +{ + public static final String NAME_SPACE_PREFIX = "stn_"; + public static final String PERIOD_SEPARATOR = "."; + private static int prefixCount = 1; + + protected String attrFormDefault = null; + protected String elementFormDefault = null; + protected Hashtable targetNamespacePrefixMap = new Hashtable(); + protected Hashtable schemaMap = new Hashtable(); + protected Hashtable sdoAnnoMap = new Hashtable(); + protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); + private TuscanyTypeTable typeTable = new TuscanyTypeTable(); + protected SchemaBuilder schemaBuilder = null; + protected Map schemaLocationMap = null; + + private static final Log log = LogFactory.getLog(SchemaGenerator.class); + private ClassLoader classLoader; + private String className; + + // to keep loadded method using JAM + private JMethod methods []; + + //to store byte code method using Axis 1.x codes + private MethodTable methodTable; + private String schemaTargetNameSpace; + private String schema_namespace_prefix; + private Class clazz; + private ArrayList excludeMethods = new ArrayList(); + + public TuscanySchemaGenerator(ClassLoader loader, + String className, + String schematargetNamespace, + String schematargetNamespacePrefix, + Map schemaLocMap) + throws Exception + { + DataObjectUtil.initRuntime(); + this.classLoader = loader; + this.className = className; + clazz = Class.forName(className, true, loader); + methodTable = new MethodTable(clazz); + this.schemaTargetNameSpace = schematargetNamespace; + this.schema_namespace_prefix = schematargetNamespacePrefix; + this.schemaLocationMap = schemaLocMap; + + initializeSchemaMap(this.schemaTargetNameSpace, this.schema_namespace_prefix); + schemaBuilder = new SchemaBuilder(xmlSchemaCollection, + schemaMap, + targetNamespacePrefixMap, + typeTable, + getAttrFormDefault(), + getElementFormDefault(), + schemaLocMap, + this.classLoader ); + } + + /** + * Generates schema for all the parameters in method. First generates schema + * for all different parameter type and later refers to them. + * + * @return Returns XmlSchema. + * @throws Exception + */ + public Collection buildWSDLTypes() throws Exception + { + JamServiceFactory factory = JamServiceFactory.getInstance(); + JamServiceParams jam_service_parms = factory.createServiceParams(); + //setting the classLoder +// jam_service_parms.setParentClassLoader(factory.createJamClassLoader(classLoader)); + //it can posible to add the classLoader as well + jam_service_parms.addClassLoader(classLoader); + jam_service_parms.includeClass(className); + JamService service = factory.createService(jam_service_parms); + + JamClassIterator jClassIter = service.getClasses(); + //all most all the time the ittr will have only one class in it + while (jClassIter.hasNext()) + { + JClass jclass = (JClass) jClassIter.next(); + // serviceName = jclass.getSimpleName(); + //todo in the future , when we support annotation we can use this + //JAnnotation[] annotations = jclass.getAnnotations(); + + /** + * Schema genertaion done in two stage 1. Load all the methods and + * create type for methods parameters (if the parameters are Bean + * then it will create Complex types for those , and if the + * parameters are simple type which decribe in SimpleTypeTable + * nothing will happen) 2. In the next stage for all the methods + * messages and port types will be creteated + */ + methods = jclass.getDeclaredMethods(); + + // since we do not support overload + HashMap uniqueMethods = new HashMap(); + XmlSchemaComplexType methodSchemaType = null; + XmlSchemaSequence sequence = null; + QName methodPartSchemaTypeName = null; + for (int i = 0; i < methods.length; i++) + { + String methodName = methods[i].getSimpleName(); + JMethod jMethod = methods[i]; + // no need to think abt this method , since that is system + // config method + if (excludeMethods.contains(jMethod.getSimpleName())) { + continue; + } + //if (jMethod.getSimpleName().equals("init") + // || "setOperationContext".equals(jMethod.getSimpleName()) + // || "destroy".equals(jMethod.getSimpleName())) + // continue; + if (uniqueMethods.get(jMethod.getSimpleName()) != null) { + throw new Exception( + " Sorry we don't support methods overloading !!!! "); + } + + if (!jMethod.isPublic()) { + // no need to generate Schema for non public methods + continue; + } + + uniqueMethods.put(jMethod.getSimpleName(), jMethod); + JParameter [] paras = jMethod.getParameters(); + String parameterNames [] = null; + if (paras.length > 0) + { + parameterNames = methodTable.getParameterNames(methodName); + sequence = new XmlSchemaSequence(); + + //create the schema type for the method wrapper + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName()); + methodSchemaType.setParticle(sequence); + } + + for (int j = 0; j < paras.length; j++) + { + JParameter methodParameter = paras[j]; + JClass paraType = methodParameter.getType(); + generateSchemaForType(sequence, paraType, + ( parameterNames != null && parameterNames[j] != null )? parameterNames[j] : methodParameter.getSimpleName()); + } + // for its return type + JClass returnType = jMethod.getReturnType(); + QName methodReturnSchemaTypeName = null; + + if (!returnType.isVoidType()) + { + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE); + sequence = new XmlSchemaSequence(); + methodSchemaType.setParticle(sequence); + generateSchemaForType(sequence, returnType, "return"); + } + } + //generateWrapperElements(methods); + } + return schemaMap.values(); + } + + private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName) throws Exception + { + boolean isArrayType = type.isArrayType(); + if ( isArrayType ) + { + type = type.getArrayComponentType(); + } + + String classTypeName = type.getQualifiedName(); + + QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName); + if ( schemaTypeName == null ) + { + schemaTypeName = + schemaBuilder.generateSchema(type); + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + addImportORInclude((XmlSchema)schemaMap.get(schemaTargetNameSpace), schemaTypeName); + + } + else + { + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + } + + return schemaTypeName; + } + + private void addContentToMethodSchemaType(XmlSchemaSequence sequence, + QName schemaTypeName, + String paraName, + boolean isArray ) + { + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(paraName); + elt1.setSchemaTypeName(schemaTypeName); + sequence.getItems().add(elt1); + + if ( isArray ) + { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + } + + private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) + { + XmlSchema xmlSchema = (XmlSchema)schemaMap.get(schemaTargetNameSpace); + QName elementName = new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); + + XmlSchemaElement globalElement = new XmlSchemaElement(); + globalElement.setSchemaType(complexType); + globalElement.setName(formGlobalElementName(localPartName)); + globalElement.setQName(elementName); + + xmlSchema.getItems().add(globalElement); + xmlSchema.getElements().add(elementName, globalElement); + + typeTable.addComplexSchemaType(this.schemaTargetNameSpace, globalElement.getName(), elementName); + + return complexType; + } + + + private String formGlobalElementName(String typeName) + { + String firstChar = typeName.substring(0,1); + return typeName.replaceFirst(firstChar, firstChar.toLowerCase()); + } + + public TuscanyTypeTable getTypeTable() { + return typeTable; + } + + public JMethod[] getMethods() { + return methods; + } + + private String generatePrefix() { + return NAME_SPACE_PREFIX + prefixCount++; + } + + public void setExcludeMethods(ArrayList excludeMethods) { + this.excludeMethods = excludeMethods; + } + + private void initializeSchemaMap(String targetNamespace, String targetNamespacePrefix) + { + XmlSchema xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); + xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); + + targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix); + schemaMap.put(targetNamespace, xmlSchema); + + + NamespaceMap prefixmap = new NamespaceMap(); + prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, TuscanyTypeTable.XML_SCHEMA_URI); + prefixmap.put(targetNamespacePrefix, targetNamespace); + xmlSchema.setNamespaceContext(prefixmap); + } + + private void setFormDefaults() + { + + } + + public Hashtable getSdoAnnoMap() { + return sdoAnnoMap; + } + + public void setSdoAnnoMap(Hashtable sdoAnnoMap) { + this.sdoAnnoMap = sdoAnnoMap; + } + + private void addImportORInclude(XmlSchema xmlSchema, QName schemaTypeName) + { + //decide whether there must be an import or an include + if ( xmlSchema.getTargetNamespace().equals(schemaTypeName.getNamespaceURI()) ) + { + XmlSchema containingSchema = (XmlSchema)schemaMap.get(schemaTypeName.getNamespaceURI()); + //if the type is not defined in the Schema then include + if ( containingSchema.getTypeByName(schemaTypeName) == null ) + { + String schemaLocation = null; + if ( (schemaLocation = (String)schemaLocationMap.get(schemaTypeName.getNamespaceURI())) != null ) + { + schemaLocation = DEFAULT_SCHEMA_LOCATION; + } + + XmlSchemaInclude includeElement = new XmlSchemaInclude(); + includeElement.setSchemaLocation(schemaLocation); + + if ( !xmlSchema.getIncludes().contains(includeElement) ) + { + xmlSchema.getIncludes().add(includeElement); + } + } + } + else + { + if (!((NamespaceMap)xmlSchema.getNamespaceContext()).values(). + contains(schemaTypeName.getNamespaceURI())) + { + XmlSchemaImport importElement = new XmlSchemaImport(); + importElement.setNamespace(schemaTypeName.getNamespaceURI()); + xmlSchema.getItems().add(importElement); + ((NamespaceMap)xmlSchema.getNamespaceContext()). + put(generatePrefix(), schemaTypeName.getNamespaceURI()); + } + } + } + + private XmlSchemaForm getAttrFormDefaultSetting() + { + if ( FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault()) ) + { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } + else + { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private XmlSchemaForm getElementFormDefaultSetting() + { + if ( FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault()) ) + { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } + else + { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + public String getAttrFormDefault() { + return attrFormDefault; + } + + public void setAttrFormDefault(String attrFormDefault) { + this.attrFormDefault = attrFormDefault; + } + + public String getElementFormDefault() { + return elementFormDefault; + } + + public void setElementFormDefault(String elementFormDefault) { + this.elementFormDefault = elementFormDefault; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java new file mode 100644 index 0000000000..4abd7a7ce7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java @@ -0,0 +1,225 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.codehaus.jam.JClass; + +public class TuscanyTypeTable +{ + public static final String XML_SCHEMA_URI = "http://www.w3.org/2001/XMLSchema"; + public static final String XS_URI_PREFIX = "xs"; + public static final QName XS_QNAME = new QName(XML_SCHEMA_URI, "schema", XS_URI_PREFIX); + public static final String DELIMITER = "#"; + + private Hashtable simpleXSDTypes; + private Hashtable complexXSDTypes; + + public static String asQualifiedName(String uri, String typeName) + { + return (uri + DELIMITER + typeName); + } + + + public TuscanyTypeTable() + { + simpleXSDTypes = new Hashtable(); + complexXSDTypes = new Hashtable(); + populateSimpleXSDTypes(); + populateStdSDOTypes(); + } + + private void populateStdSDOTypes() + { + simpleXSDTypes.put("Boolean", + new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX)); + simpleXSDTypes.put("Byte", + new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX)); + simpleXSDTypes.put("Bytes", + new QName(XML_SCHEMA_URI, "hexBinary", XS_URI_PREFIX)); + simpleXSDTypes.put("Character", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("DataObject", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("Date", + new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX)); + simpleXSDTypes.put("Day", + new QName(XML_SCHEMA_URI, "gDay", XS_URI_PREFIX)); + simpleXSDTypes.put("Decimal", + new QName(XML_SCHEMA_URI, "decimal", XS_URI_PREFIX)); + simpleXSDTypes.put("Double", + new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX)); + simpleXSDTypes.put("Duration", + new QName(XML_SCHEMA_URI, "duration", XS_URI_PREFIX)); + simpleXSDTypes.put("Float", + new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX)); + simpleXSDTypes.put("Int", + new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX)); + simpleXSDTypes.put("Integer", + new QName(XML_SCHEMA_URI, "integer", XS_URI_PREFIX)); + simpleXSDTypes.put("Long", + new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX)); + simpleXSDTypes.put("Month", + new QName(XML_SCHEMA_URI, "gMonth", XS_URI_PREFIX)); + simpleXSDTypes.put("monthDay", + new QName(XML_SCHEMA_URI, "gMonthDay", XS_URI_PREFIX)); + simpleXSDTypes.put("Object", + new QName(XML_SCHEMA_URI, "anySimpleType", XS_URI_PREFIX)); + simpleXSDTypes.put("Short", + new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX)); + simpleXSDTypes.put("String", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("Strings", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("Time", + new QName(XML_SCHEMA_URI, "time", XS_URI_PREFIX)); + simpleXSDTypes.put("Year", + new QName(XML_SCHEMA_URI, "gYear", XS_URI_PREFIX)); + simpleXSDTypes.put("YearMonth", + new QName(XML_SCHEMA_URI, "gYearMonth", XS_URI_PREFIX)); + simpleXSDTypes.put("YearMonthDay", + new QName(XML_SCHEMA_URI, "date", XS_URI_PREFIX)); + simpleXSDTypes.put("URI", + new QName(XML_SCHEMA_URI, "anyURI", XS_URI_PREFIX)); + } + + private void populateSimpleXSDTypes() { + //todo pls use the types from org.apache.ws.commons.schema.constants.Constants + simpleXSDTypes.put("int", + new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.String", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("boolean", + new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX)); + simpleXSDTypes.put("float", + new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX)); + simpleXSDTypes.put("double", + new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX)); + simpleXSDTypes.put("short", + new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX)); + simpleXSDTypes.put("long", + new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX)); + simpleXSDTypes.put("byte", + new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX)); + simpleXSDTypes.put("char", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Integer", + new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Double", + new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Float", + new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Long", + new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Character", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Boolean", + new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Byte", + new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Short", + new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX)); + simpleXSDTypes.put("java.util.Date", + new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX)); + simpleXSDTypes.put("java.util.Calendar", + new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Object", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("java.math.BigDecimal", + new QName(XML_SCHEMA_URI, "decimal", XS_URI_PREFIX)); + + // Any types + simpleXSDTypes.put(OMElement.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put(ArrayList.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put(Vector.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put(List.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + } + + public QName getStdSdoType(String typename) + { + return (QName) simpleXSDTypes.get(typename); + } + + public QName getComplexSchemaTypeName(String sdoURI, String sdoTypeName) + { + return (QName) complexXSDTypes.get(asQualifiedName(sdoURI, sdoTypeName)); + } + + public QName getComplexSchemaTypeName(JClass javaClass, ClassLoader cl) throws Exception + { + String namespace = Java2WSDLUtils.schemaNamespaceFromClassName( + javaClass.getQualifiedName(), cl).toString(); + return (QName) complexXSDTypes.get(asQualifiedName(namespace, javaClass.getSimpleName())); + } + + public boolean isSimpleType(String typeName) + { + Iterator keys = simpleXSDTypes.keySet().iterator(); + while (keys.hasNext()) { + String s = (String) keys.next(); + if (s.equals(typeName)) { + return true; + } + } + return false; + } + + public QName getSimpleSchemaTypeName(String typename) + { + return (QName) simpleXSDTypes.get(typename); + } + + public void addSimpleSchemaType(String typeName, QName schemaType) + { + simpleXSDTypes.put(typeName, schemaType); + } + + + public void addComplexSchemaType(String namespaceURI, String name, QName schemaType) + { + complexXSDTypes.put(asQualifiedName(namespaceURI, name), schemaType); + } + + + public QName getQNamefortheType(String namespaceURI, String typeName) + { + if ( XML_SCHEMA_URI.equals(namespaceURI)) + { + return getSimpleSchemaTypeName(typeName); + } + else + { + return getComplexSchemaTypeName(namespaceURI, typeName); + } + } +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java new file mode 100644 index 0000000000..a742e8913d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java @@ -0,0 +1,373 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaForm; +import org.apache.ws.commons.schema.XmlSchemaImport; +import org.apache.ws.commons.schema.XmlSchemaInclude; +import org.apache.ws.commons.schema.XmlSchemaSequence; +import org.apache.ws.commons.schema.utils.NamespaceMap; +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.SchemaGenerator; +import org.apache.ws.java2wsdl.bytecode.MethodTable; +import org.codehaus.jam.JClass; +import org.codehaus.jam.JMethod; +import org.codehaus.jam.JParameter; +import org.codehaus.jam.JamClassIterator; +import org.codehaus.jam.JamService; +import org.codehaus.jam.JamServiceFactory; +import org.codehaus.jam.JamServiceParams; + +public class TuscanyWSDLTypesGenerator implements TuscanyJava2WSDLConstants { + public static final String NAME_SPACE_PREFIX = "stn_"; + + public static final String PERIOD_SEPARATOR = "."; + + private static int prefixCount = 1; + + protected GenerationParameters generationParams; + + protected Hashtable targetNamespacePrefixMap = new Hashtable(); + + protected Hashtable schemaMap = new Hashtable(); + + protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); + + private TuscanyTypeTable typeTable = new TuscanyTypeTable(); + + protected SchemaBuilder schemaBuilder = null; + + protected Map schemaLocationMap = null; + + private static final Log log = LogFactory.getLog(SchemaGenerator.class); + + // to keep loadded method using JAM + private JMethod methods[]; + + //to store byte code method using Axis 1.x codes + private MethodTable methodTable; + + private Class clazz; + + private ArrayList excludeMethods = new ArrayList(); + + public TuscanyWSDLTypesGenerator(GenerationParameters genParams) throws Exception { + DataObjectUtil.initRuntime(); + this.generationParams = genParams; + + clazz = Class.forName(generationParams.getSourceClassName(), + true, + generationParams.getClassLoader()); + methodTable = new MethodTable(clazz); + + initializeSchemaMap(generationParams.getSchemaTargetNamespace(), + generationParams.getSchemaTargetNamespacePrefix()); + schemaBuilder = new SchemaBuilder(xmlSchemaCollection, + schemaMap, + targetNamespacePrefixMap, + typeTable, + generationParams.getAttrFormDefault(), + generationParams.getElementFormDefault(), + generationParams.getSchemaLocationMap(), + generationParams.getClassLoader()); + } + + /** + * Generates schema for all the parameters in method. First generates schema + * for all different parameter type and later refers to them. + * + * @return Returns XmlSchema. + * @throws Exception + */ + public Collection buildWSDLTypes() throws Exception { + JamServiceFactory factory = JamServiceFactory.getInstance(); + JamServiceParams jam_service_parms = factory.createServiceParams(); + //setting the classLoder +// jam_service_parms.setParentClassLoader(factory.createJamClassLoader(classLoader)); + //it can posible to add the classLoader as well + jam_service_parms.addClassLoader(generationParams.getClassLoader()); + jam_service_parms.includeClass(generationParams.getSourceClassName()); + + for ( int count = 0 ; count < generationParams.getExtraClasses().size() ; ++count ) + { + jam_service_parms.includeClass((String)generationParams.getExtraClasses().get(count)); + } + + JamService service = factory.createService(jam_service_parms); + QName extraSchemaTypeName = null; + JamClassIterator jClassIter = service.getClasses(); + //all most all the time the ittr will have only one class in it + while (jClassIter.hasNext()) { + JClass jclass = (JClass) jClassIter.next(); + // serviceName = jclass.getSimpleName(); + //todo in the future , when we support annotation we can use this + //JAnnotation[] annotations = jclass.getAnnotations(); + + if ( jclass.getQualifiedName().equals(generationParams.getSourceClassName()) ) + { + /** + * Schema genertaion done in two stage 1. Load all the methods and + * create type for methods parameters (if the parameters are Bean + * then it will create Complex types for those , and if the + * parameters are simple type which decribe in SimpleTypeTable + * nothing will happen) 2. In the next stage for all the methods + * messages and port types will be creteated + */ + methods = jclass.getDeclaredMethods(); + //short the elements in the array + Arrays.sort(methods); + + // since we do not support overload + HashMap uniqueMethods = new HashMap(); + XmlSchemaComplexType methodSchemaType; + XmlSchemaSequence sequence = null; + + for (int i = 0; i < methods.length; i++) { + JMethod jMethod = methods[i]; + + String methodName = methods[i].getSimpleName(); + // no need to think abt this method , since that is system + // config method + if (excludeMethods.contains(jMethod.getSimpleName())) { + continue; + } + + if (uniqueMethods.get(jMethod.getSimpleName()) != null) { + throw new Exception( + " Sorry we don't support methods overloading !!!! "); + } + + if (!jMethod.isPublic()) { + // no need to generate Schema for non public methods + continue; + } + uniqueMethods.put(jMethod.getSimpleName(), jMethod); + //create the schema type for the method wrapper + + uniqueMethods.put(jMethod.getSimpleName(), jMethod); + JParameter [] paras = jMethod.getParameters(); + String parameterNames [] = null; + if (paras.length > 0) { + parameterNames = methodTable.getParameterNames(methodName); + sequence = new XmlSchemaSequence(); + + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName()); + methodSchemaType.setParticle(sequence); + } + + for (int j = 0; j < paras.length; j++) { + JParameter methodParameter = paras[j]; + JClass paraType = methodParameter.getType(); + generateSchemaForType(sequence, paraType, + (parameterNames != null && parameterNames[j] != null) ? parameterNames[j] : methodParameter.getSimpleName()); + } + // for its return type + JClass returnType = jMethod.getReturnType(); + + if (!returnType.isVoidType()) { + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE); + sequence = new XmlSchemaSequence(); + methodSchemaType.setParticle(sequence); + generateSchemaForType(sequence, returnType, "return"); + } + } + } + else + { + //generate the schema type for extra classes + extraSchemaTypeName = typeTable.getSimpleSchemaTypeName(jclass.getQualifiedName()); + if (extraSchemaTypeName == null) + { + extraSchemaTypeName = schemaBuilder.generateSchema(jclass); + } + } + } + return schemaMap.values(); + } + + private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName) throws Exception { + boolean isArrayType = type.isArrayType(); + if (isArrayType) { + type = type.getArrayComponentType(); + } + + String classTypeName = type.getQualifiedName(); + + QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName); + if (schemaTypeName == null) { + schemaTypeName = schemaBuilder.generateSchema(type); + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + addImportORInclude((XmlSchema) schemaMap.get(generationParams.getSchemaTargetNamespace()), + schemaTypeName); + + } else { + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + } + + return schemaTypeName; + } + + private void addContentToMethodSchemaType(XmlSchemaSequence sequence, + QName schemaTypeName, + String paraName, + boolean isArray) { + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(paraName); + elt1.setSchemaTypeName(schemaTypeName); + sequence.getItems().add(elt1); + + if (isArray) { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + } + + private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) throws Exception { + XmlSchema xmlSchema = (XmlSchema) schemaMap.get(generationParams.getSchemaTargetNamespace()); + QName elementName = new QName(generationParams.getSchemaTargetNamespace(), + localPartName, + generationParams.getSchemaTargetNamespacePrefix()); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); + + XmlSchemaElement globalElement = new XmlSchemaElement(); + globalElement.setSchemaType(complexType); + globalElement.setName(formGlobalElementName(localPartName)); + globalElement.setQName(elementName); + + xmlSchema.getItems().add(globalElement); + xmlSchema.getElements().add(elementName, + globalElement); + + typeTable.addComplexSchemaType(generationParams.getSchemaTargetNamespace(), + globalElement.getName(), + elementName); + + return complexType; + } + + private String formGlobalElementName(String typeName) { + String firstChar = typeName.substring(0, + 1); + return typeName.replaceFirst(firstChar, + firstChar.toLowerCase()); + } + + public TuscanyTypeTable getTypeTable() { + return typeTable; + } + + public JMethod[] getMethods() { + return methods; + } + + private String generatePrefix() { + return NAME_SPACE_PREFIX + prefixCount++; + } + + public void setExcludeMethods(ArrayList excludeMethods) { + this.excludeMethods = excludeMethods; + } + + private void initializeSchemaMap(String targetNamespace, String targetNamespacePrefix) { + XmlSchema xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); + xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); + + targetNamespacePrefixMap.put(targetNamespace, + targetNamespacePrefix); + schemaMap.put(targetNamespace, + xmlSchema); + + NamespaceMap prefixmap = new NamespaceMap(); + prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, + TuscanyTypeTable.XML_SCHEMA_URI); + prefixmap.put(targetNamespacePrefix, + targetNamespace); + xmlSchema.setNamespaceContext(prefixmap); + } + + + private void addImportORInclude(XmlSchema xmlSchema, QName schemaTypeName) { + //decide whether there must be an import or an include + if (xmlSchema.getTargetNamespace().equals(schemaTypeName.getNamespaceURI())) { + XmlSchema containingSchema = (XmlSchema) schemaMap.get(schemaTypeName.getNamespaceURI()); + //if the type is not defined in the Schema then include + if (containingSchema.getTypeByName(schemaTypeName) == null) { + String schemaLocation = null; + if ((schemaLocation = (String) schemaLocationMap.get(schemaTypeName.getNamespaceURI())) != null) { + schemaLocation = DEFAULT_SCHEMA_LOCATION; + } + + XmlSchemaInclude includeElement = new XmlSchemaInclude(); + includeElement.setSchemaLocation(schemaLocation); + + if (!xmlSchema.getIncludes().contains(includeElement)) { + xmlSchema.getIncludes().add(includeElement); + } + } + } else { + if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values() + .contains(schemaTypeName.getNamespaceURI())) { + XmlSchemaImport importElement = new XmlSchemaImport(); + importElement.setNamespace(schemaTypeName.getNamespaceURI()); + xmlSchema.getItems().add(importElement); + ((NamespaceMap) xmlSchema.getNamespaceContext()).put(generatePrefix(), + schemaTypeName.getNamespaceURI()); + } + } + } + + private XmlSchemaForm getAttrFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(generationParams.getAttrFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private XmlSchemaForm getElementFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(generationParams.getElementFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java new file mode 100644 index 0000000000..26b3d092de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.EventObject; + +public class WSDLGenEvent extends EventObject { + private int generationPhase = WSDLGenListener.UNKNOWN; + + public WSDLGenEvent(Object source, int genPhase) { + super(source); + this.generationPhase = genPhase; + } + + public int getGenerationPhase() { + return generationPhase; + } + + public void setGenerationPhase(int generationPhase) { + this.generationPhase = generationPhase; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java new file mode 100644 index 0000000000..788d162f34 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +public interface WSDLGenListener { + public static int UNKNOWN = 0; + + public static int INPUT_ARGS_PARSING = 1; + + public static int INPUT_ARGS_VALIDATION = 2; + + public static int WSDL_MODEL_CREATION = 3; + + public static int WSDL_MODEL_WRITING = 4; + + public static String[] phaseAsString = { "Unknown", + "Input Arguments Parsing", "Input Arguments Validation", + "WSDL Model Creation", "WSDL Model Writing" }; + + public void WSDLGenPhaseStarted(WSDLGenEvent event); + + public void WSDLGenPhaseCompleted(WSDLGenEvent event); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java new file mode 100644 index 0000000000..b30b8cd62b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java @@ -0,0 +1,143 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.util; + +import java.util.ArrayList; +import java.util.List; + +public class XMLNameUtil { + + /** + * Returns a valid Java name from an XML Name. + * + * @param name + * @param isUpperCase + * @return a valid Java name from an XML Name + */ + public static String getJavaNameFromXMLName(String name, boolean isUpperCase) { + List parsedName = parseName(name, '_'); + StringBuilder result = new StringBuilder(64 * parsedName.size()); + for (String nameComponent: parsedName) { + if (nameComponent.length() > 0) { + if (result.length() > 0 || isUpperCase) { + result.append(Character.toUpperCase(nameComponent.charAt(0))); + result.append(nameComponent.substring(1)); + } else { + result.append(nameComponent); + } + } + } + + if (result.length() == 0) { + return "_"; + } + if (Character.isJavaIdentifierStart(result.charAt(0))) { + return isUpperCase ? result.toString() : decapitalizeName(result.toString()); + } + return "_" + result; + } + + /** + * Decapitalize a name. + * @param name + * @return a decapitalized name + */ + public static String decapitalizeName(String name) { + if (name.length() == 0) { + return name; + } else { + String lowerName = name.toLowerCase(); + int i; + for (i = 0; i < name.length(); i++) { + if (name.charAt(i) == lowerName.charAt(i)) { + break; + } + } + if (i > 1 && i < name.length()) { + --i; + } + return name.substring(0, i).toLowerCase() + name.substring(i); + } + } + + /** + * Parse the given name. + * + * @param sourceName + * @param separator + * @return some stuff parsed from the name + */ + private static List parseName(String sourceName, char separator) { + List result = new ArrayList(); + if (sourceName != null) { + StringBuilder currentWord = new StringBuilder(64); + boolean lastIsLower = false; + int index; + int length; + for (index = 0, length = sourceName.length(); index < length; ++index) { + char curChar = sourceName.charAt(index); + if (!Character.isJavaIdentifierPart(curChar)) { + curChar = separator; + } + if (Character.isUpperCase(curChar) + || (!lastIsLower && Character.isDigit(curChar)) + || curChar == separator) { + + if (lastIsLower && currentWord.length() > 1 + || curChar == separator && currentWord.length() > 0) { + result.add(currentWord.toString()); + currentWord = new StringBuilder(64); + } + lastIsLower = false; + } else { + if (!lastIsLower) { + int currentWordLength = currentWord.length(); + if (currentWordLength > 1) { + char lastChar = currentWord.charAt(--currentWordLength); + currentWord.setLength(currentWordLength); + result.add(currentWord.toString()); + currentWord = new StringBuilder(64); + currentWord.append(lastChar); + } + } + lastIsLower = true; + } + + if (curChar != separator) { + currentWord.append(curChar); + } + } + + result.add(currentWord.toString()); + } + return result; + } + + /** + * Return an EPackage name for the given namespace. + * + * @param namespace + * @return an EPackage name for the given namespace + */ + public static String getPackageNameFromNamespace(String namespace) { + return org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder.getDefaultPackageName(namespace); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java new file mode 100644 index 0000000000..22383e99db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java @@ -0,0 +1,222 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.axis2.description.AxisMessage; +import org.apache.axis2.description.AxisOperation; +import org.apache.axis2.util.FileWriter; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.emitter.JavaEmitter; +import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter; +import org.apache.axis2.wsdl.databinding.TypeMapper; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import static org.apache.tuscany.tools.java2wsdl.util.XMLNameUtil.getJavaNameFromXMLName; + +/** + * Overrides the Axis2 JavaEmitter to generate unwrapped methods. + */ +public class JavaInterfaceEmitter extends JavaEmitter { + + private CodeGenConfiguration codegenConfiguration; + private TypeMapper typeMapper; + + public void setCodeGenConfiguration(CodeGenConfiguration configuration) { + super.setCodeGenConfiguration(configuration); + codegenConfiguration=configuration; + } + + public void setMapper(TypeMapper typeMapper) { + super.setMapper(typeMapper); + this.typeMapper = typeMapper; + } + + private List getParameterElementList(Document doc, AxisMessage message, boolean wrapped) { + List parameterElementList = new ArrayList(); + + if (message != null && message.getElementQName()!=null) { + + SDODataBindingTypeMappingEntry typeMappingEntry = + (SDODataBindingTypeMappingEntry)this.typeMapper.getTypeMappingObject(message.getElementQName()); + List typeMappings; + if (wrapped) { + typeMappings = (List)typeMappingEntry.getPropertyClassNames(); + } else { + typeMappings = new ArrayList(); + typeMappings.add(typeMappingEntry.getClassName()); + } + + for (int i=0; i> Generating Java class " + packageName + "." + className); + File outputFile = FileWriter.createClassFile(this.codegenConfiguration.getOutputLocation(), + packageName, className, ".java"); + if (outputFile.exists()) { + outputFile.delete(); + } + + writeClass(interfaceModel, interfaceWriter); + } + + protected String makeJavaClassName(String word) { + //return XMLNameUtil.getJavaNameFromXMLName(word, true); + return getJavaNameFromXMLName(word, true); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java new file mode 100644 index 0000000000..b68277566a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java @@ -0,0 +1,230 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import static org.apache.tuscany.tools.java2wsdl.util.XMLNameUtil.getPackageNameFromNamespace; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Binding; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.PortType; +import javax.wsdl.Service; +import javax.wsdl.WSDLException; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; +import org.apache.axis2.util.XMLUtils; +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension; +import org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension; +import org.apache.axis2.wsdl.codegen.extension.PackageFinder; +import org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension; +import org.apache.axis2.wsdl.databinding.JavaTypeMapper; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +public class JavaInterfaceGenerator { + + private List codegenExtensions = new ArrayList(); + private List codegenConfigurations= new LinkedList(); + + + + + public JavaInterfaceGenerator(String uri, String ports[], String outputLocation, String packageName, + Map typeMapping) throws CodeGenerationException { + + Definition definition; + try { + definition = readWSDL(uri); + } catch (WSDLException e) { + throw new CodeGenerationException(e); + } + + HashSet interestedPorts= ports == null ? null : new HashSet(Arrays.asList(ports)); + + // Service service=(Service)definition.getServices().values().().next(); + + HashSet donePortTypes= new HashSet(); + + for (Iterator sIter = definition.getServices().values().iterator(); sIter.hasNext(); ) { + Service service = (Service) sIter.next(); + + QName serviceQname = service.getQName(); + for (Iterator pIter= service.getPorts().values().iterator(); pIter.hasNext(); ) { + Port port= (Port) pIter.next(); + if(interestedPorts != null && ! interestedPorts.contains(port.getName())) continue;//not iterested. + PortType portType= getPortType(port); + if(null == portType) continue; // not connected. + QName pQName= portType.getQName(); + if(donePortTypes.contains(pQName)) continue; //allready did it. + donePortTypes.add(pQName); + + if (packageName == null) { + + packageName = getPackageNameFromNamespace(definition.getTargetNamespace()); + } + JavaTypeMapper typeMapper = new JavaTypeMapper(); + for (Map.Entry e : typeMapping.entrySet()) { + typeMapper.addTypeMappingObject(e.getKey(), e.getValue()); + } + AxisService axisService; + try { + axisService = new WSDL11ToAxisServiceBuilder(definition, serviceQname, port.getName()).populateService(); + } catch (AxisFault e) { + throw new CodeGenerationException(e); + } + axisService.setName(port.getBinding().getPortType().getQName().getLocalPart()); + CodeGenConfiguration codegenConfiguration = new CodeGenConfiguration(Collections.EMPTY_MAP); + codegenConfigurations.add(codegenConfiguration); + codegenConfiguration.setAxisService(axisService); + codegenConfiguration.setAdvancedCodeGenEnabled(false); + codegenConfiguration.setAsyncOn(false); + codegenConfiguration.setDatabindingType("sdo"); + codegenConfiguration.setGenerateAll(true); + codegenConfiguration.setGenerateDeployementDescriptor(false); + codegenConfiguration.setOutputLanguage("java"); + codegenConfiguration.setOutputLocation(new File(outputLocation)); + codegenConfiguration.setPackageName(packageName); + codegenConfiguration.setPackClasses(false); + codegenConfiguration.setPolicyMap(Collections.EMPTY_MAP); + codegenConfiguration.setPortName(port.getName()); + codegenConfiguration.setServerSide(false); + codegenConfiguration.setServiceName(service.getQName().getLocalPart()); + codegenConfiguration.setSyncOn(true); + codegenConfiguration.setTypeMapper(typeMapper); + codegenConfiguration.setWriteMessageReceiver(false); + codegenConfiguration.setWriteTestCase(false); + addExtension(new WSDLValidatorExtension(), codegenConfiguration); + addExtension(new PackageFinder(), codegenConfiguration); + addExtension(new SDODataBindingCodegenExtension(typeMapper), codegenConfiguration); + addExtension(new DefaultDatabindingExtension(), codegenConfiguration); + } + } + } + + + private PortType getPortType(Port port) { + Binding binding = port.getBinding(); + if(null != binding){ + return binding.getPortType(); + } + return null; + + } + + + @SuppressWarnings("unchecked") + private void addExtension(CodeGenExtension ext, CodeGenConfiguration codegenConfiguration) { + //ext.init(codegenConfiguration); + codegenExtensions.add(new Object[]{ext, codegenConfiguration}); + } + + public void generate() throws CodeGenerationException { + try { + for (int i = 0; i < codegenExtensions.size(); i++) { + //CodeGenExtension + Object[] pair = (Object[])codegenExtensions.get(i); + + CodeGenExtension cge= (CodeGenExtension) pair[0]; + CodeGenConfiguration cgf= (CodeGenConfiguration)pair[1]; + + cge.engage(cgf); + + } + + for(CodeGenConfiguration codegenConfiguration : codegenConfigurations){ + JavaInterfaceEmitter emitter = new JavaInterfaceEmitter(); + emitter.setCodeGenConfiguration(codegenConfiguration); + emitter.setMapper(codegenConfiguration.getTypeMapper()); + + emitter.writeInterface(false); + } + + } catch (Exception e) { + throw new CodeGenerationException(e); + } + } + + /** + * Read the WSDL file + * @param uri + * @return + * @throws WSDLException + */ + private Definition readWSDL(String uri) throws WSDLException { + + WSDLReader reader = + WSDLFactory.newInstance().newWSDLReader(); + reader.setFeature("javax.wsdl.importDocuments", true); + + File file = new File(uri); + String baseURI; + + if (uri.startsWith("http://")){ + baseURI = uri; + } else{ + if(file.getParentFile() == null){ + try { + baseURI = new File(".").getCanonicalFile().toURI().toString(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } else { + baseURI = file.getParentFile().toURI().toString(); + } + } + + Document doc; + try { + doc = XMLUtils.newDocument(uri); + } catch (ParserConfigurationException e) { + throw new WSDLException(WSDLException.PARSER_ERROR, + "Parser Configuration Error", + e); + } catch (SAXException e) { + throw new WSDLException(WSDLException.PARSER_ERROR, + "Parser SAX Error", + e); + + } catch (IOException e) { + throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e); + } + + return reader.readWSDL(baseURI, doc); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java new file mode 100644 index 0000000000..cb413bca50 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.io.File; + +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter; + +/** + * @author lresende + */ +public class RemotableInterfaceWritter extends InterfaceWriter { + private static final String REMOTABLE_INTERFACE_TEMPLATE="/RemotableInterfaceTemplate.xsl"; + + public RemotableInterfaceWritter(String outputFileLocation) { + super(outputFileLocation); + } + + public RemotableInterfaceWritter(File outputFileLocation, String language) { + super(outputFileLocation, language); + } + + /** + * Loads the template. + */ + @Override + public void loadTemplate() throws CodeGenerationException { + // the default behavior for the class writers is to use the property map from the languge specific types + // The properties are arranged in the following order + // .* .template=, + + //overrida original behaviour to always load the template we specified + this.xsltStream = this.getClass().getResourceAsStream(REMOTABLE_INTERFACE_TEMPLATE); + + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java new file mode 100644 index 0000000000..075959f985 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.extension.AbstractDBProcessingExtension; +import org.apache.axis2.wsdl.databinding.TypeMapper; + +/** + * SDO data binding codegen extension. + */ +public class SDODataBindingCodegenExtension extends AbstractDBProcessingExtension { + + private TypeMapper typeMapper; + + public SDODataBindingCodegenExtension(TypeMapper typeMapper) { + this.typeMapper=typeMapper; + } + + protected boolean testFallThrough(String dbFrameworkName) { + return !dbFrameworkName.equals("sdo"); + } + +// public void engage() { +// if (testFallThrough(configuration.getDatabindingType())) { +// return; +// } +// +// // Set the type mapper into the config +// configuration.setTypeMapper(typeMapper); +// +// } + + public void engage(CodeGenConfiguration configuration) throws CodeGenerationException { + // TODO Auto-generated method stub + if (testFallThrough(configuration.getDatabindingType())) { + return; + } + + // Set the type mapper into the config + configuration.setTypeMapper(typeMapper); + + + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java new file mode 100644 index 0000000000..2d81ef12bf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.util.List; + +/** + * This represents a type mapping entry, used by the JavaInterfaceEmitter to generate + * method signatures. + */ +public class SDODataBindingTypeMappingEntry { + + private final boolean anonymous; + private final List propertyClassNames; + private final String className; + + public SDODataBindingTypeMappingEntry(String className, boolean anonymous, List propertyClassNames) { + this.className = className; + this.anonymous = anonymous; + this.propertyClassNames = propertyClassNames; + } + + public boolean isAnonymous() { + return anonymous; + } + + public String getClassName() { + return className; + } + + public List getPropertyClassNames() { + return propertyClassNames; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java new file mode 100644 index 0000000000..8f3f7447b2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java @@ -0,0 +1,349 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sdo.helper.XSDHelperImpl; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.codegen.ecore.genmodel.GenClass; +import org.eclipse.emf.codegen.ecore.genmodel.GenModel; +import org.eclipse.emf.codegen.ecore.genmodel.GenModelFactory; +import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; +import org.eclipse.emf.codegen.util.CodeGenUtil; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.BasicExtendedMetaData; +import org.eclipse.emf.ecore.util.ExtendedMetaData; + +import commonj.sdo.helper.XSDHelper; + +public class WSDL2JavaGenerator { + + /** + * Generate Java interfaces from WSDL Usage arguments: [ -targetDirectory + * ] [ -javaPackage ] + * For example: generate somedir/somefile.wsdl Basic options: + * -targetDirectory Generates the Java source code in the specified + * directory. By default, the code is generated in the same directory as the + * input wsdl file. -javaPackage Overrides the Java package for the + * generated classes. By default the package name is derived from the + * targetNamespace of the WSDL definition being generated. For example, if + * the targetNamespace is "http://www.example.com/simple", the default + * package will be "com.example.simple". + */ + public static void main(String args[]) { + if (args.length == 0) { + printUsage(); + return; + } + + String portName = null; + String targetDirectory = null; + String wsdlJavaPackage = null; + String xsdJavaPackage = null; + + int index = 0; + for (; index < args.length && args[index].startsWith("-"); ++index) { + if (args[index].equalsIgnoreCase("-port")) { + portName = args[++index]; + } else if (args[index].equalsIgnoreCase("-targetDirectory")) { + targetDirectory = args[++index]; + } else if (args[index].equalsIgnoreCase("-javaPackage")) { + wsdlJavaPackage = args[++index]; + } + // else if (...) + else { + printUsage(); + return; + } + } + + String wsdlFileName = args[index]; + if (wsdlFileName == null || targetDirectory == null) { + printUsage(); + return; + } + + generateFromWSDL(wsdlFileName, portName!=null? new String[]{portName}:null, targetDirectory, wsdlJavaPackage, xsdJavaPackage, 0); + + } + + @SuppressWarnings("unchecked") + public static void generateFromWSDL(String wsdlFileName, String targetDirectory, + String wsdlJavaPackage, + String xsdJavaPackage, int genOptions){ + generateFromWSDL( wsdlFileName, null, targetDirectory, + wsdlJavaPackage, + xsdJavaPackage, genOptions); + + } + + + @SuppressWarnings("unchecked") + public static void generateFromWSDL(String wsdlFileName, String[] ports, + String targetDirectory, String wsdlJavaPackage, + String xsdJavaPackage, int genOptions) + { + + // Initialize the SDO runtime + DataObjectUtil.initRuntime(); + EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry); + XSDHelper xsdHelper = new XSDHelperImpl(extendedMetaData, null); + + try { + + // Load the WSDL file + File inputFile = new File(wsdlFileName).getAbsoluteFile(); + InputStream inputStream = new FileInputStream(inputFile); + + // Define SDO metadata + xsdHelper.define(inputStream, inputFile.toURI().toString()); + + if (targetDirectory == null) { + targetDirectory = new File(wsdlFileName).getCanonicalFile().getParent(); + } else { + targetDirectory = new File(targetDirectory).getCanonicalPath(); + } + + // Populate the typeMapping table that will be given to the Axis2 WSDL2Java + Map typeMapping = + new HashMap(); + if (!packageRegistry.values().isEmpty()) { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + + // Populate list of GenPackages and a map of GenClasses keyed by EClass + List genPackages = new ArrayList(); + Map genClasses = new HashMap(); + for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) { + EPackage currentEPackage = (EPackage)iter.next(); + String currentBasePackage = extractBasePackageName(currentEPackage, xsdJavaPackage); + String currentPrefix = CodeGenUtil.capName(currentEPackage.getName()); + + GenPackage currentGenPackage = createGenPackage(currentEPackage, currentBasePackage, + currentPrefix, genOptions, resourceSet); + genPackages.add(currentGenPackage); + for (GenClass genClass : (List)currentGenPackage.getGenClasses()) { + genClasses.put(genClass.getEcoreClass(), genClass); + } + + } + + // Process all the SDO packages + // Populate the qname -> interfaceName typeMapping table + for (GenPackage currentGenPackage : genPackages) { + EPackage currentEPackage = currentGenPackage.getEcorePackage(); + + // Populate the type mappings for all the complex types + for (GenClass genClass : (List)currentGenPackage.getGenClasses()) { + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(genClass.getEcoreClass())); + String interfaceName = currentGenPackage.getInterfacePackageName() + '.' + + genClass.getInterfaceName(); + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(interfaceName, false, null); + typeMapping.put(qname, typeMappingEntry); + } + + // Process all the global XSD elements + EClass documentRoot = extendedMetaData.getDocumentRoot(currentEPackage); + if (documentRoot != null) { + for (EStructuralFeature element : (List)extendedMetaData + .getElements(documentRoot)) { + EClassifier elementType = element.getEType(); + + // Handle a complex type + if (elementType instanceof EClass) { + EClass eClass = (EClass)elementType; + + GenClass genClass = genClasses.get(elementType); + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(element)); + String interfaceName = genClass.getGenPackage().getInterfacePackageName() + + '.' + genClass.getInterfaceName(); + boolean anonymous = extendedMetaData.isAnonymous(eClass); + + // Build list of property class names + List propertyClassNames=new ArrayList(); + for (EStructuralFeature feature : (List)eClass.getEStructuralFeatures()) { + EClassifier propertyType = feature.getEType(); + if (propertyType instanceof EClass) { + GenClass propertyGenClass = genClasses.get(propertyType); + String propertyClassName = propertyGenClass.getGenPackage().getInterfacePackageName() + + '.' + propertyGenClass.getInterfaceName(); + propertyClassNames.add(propertyClassName); + } else if (propertyType instanceof EClassifier) { + String propertyClassName = propertyType.getInstanceClass().getName(); + propertyClassNames.add(propertyClassName); + } + } + + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(interfaceName, anonymous, propertyClassNames); + typeMapping.put(qname, typeMappingEntry); + + } else { + + // Handle a simple type + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(element)); + String className = elementType.getInstanceClass().getName(); + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(className, false, null); + typeMapping.put(qname, typeMappingEntry); + } + } + } + } + } + + try { + JavaInterfaceGenerator codeGenerator = new JavaInterfaceGenerator(wsdlFileName, + ports, + targetDirectory, + wsdlJavaPackage, + typeMapping); + codeGenerator.generate(); + } catch (Exception e) { + throw new IllegalArgumentException(e); + } + + } catch (IOException e) { + throw new IllegalArgumentException(e); + } + } + + @SuppressWarnings("unchecked") + public static GenPackage createGenPackage(EPackage ePackage, String basePackage, String prefix, + int genOptions, ResourceSet resourceSet) { + GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions); + + URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore"); + URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel"); + + Resource ecoreResource = resourceSet.createResource(ecoreURI); + ecoreResource.getContents().add(ePackage); + + Resource genModelResource = resourceSet.createResource(genModelURI); + genModelResource.getContents().add(genModel); + + return (GenPackage)genModel.getGenPackages().get(0); + } + + public static GenModel ecore2GenModel(EPackage ePackage, String basePackage, + String prefix, int genOptions) { + GenModel genModel = GenModelFactory.eINSTANCE.createGenModel(); + genModel.initialize(Collections.singleton(ePackage)); + + genModel.setRootExtendsInterface(""); + genModel.setRootImplementsInterface("commonj.sdo.DataObject"); + genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.DataObjectImpl"); + genModel.setFeatureMapWrapperInterface("commonj.sdo.Sequence"); + genModel.setFeatureMapWrapperInternalInterface("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setFeatureMapWrapperClass("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setSuppressEMFTypes(true); + genModel.setSuppressEMFMetaData(true); + genModel.setSuppressEMFModelTags(true); + genModel.setCanGenerate(true); + // FIXME workaround java.lang.NoClassDefFoundError: + // org/eclipse/jdt/core/jdom/IDOMNode with 02162006 build + genModel.setFacadeHelperClass("Hack"); + genModel.setForceOverwrite(true); + + GenPackage genPackage = (GenPackage)genModel.getGenPackages().get(0); + + if (basePackage != null) { + genPackage.setBasePackage(basePackage); + } + if (prefix != null) { + genPackage.setPrefix(prefix); + } + + return genModel; + } + + public static String extractBasePackageName(EPackage ePackage, String javaPackage) { + String qualifiedName = javaPackage != null ? javaPackage : ePackage.getName(); + String name = /* CodeGenUtil. */shortName(qualifiedName); + String baseName = qualifiedName.substring(0, qualifiedName.length() - name.length()); + if (javaPackage != null || !name.equals(qualifiedName)) { + ePackage.setName(name); + } + return baseName != null ? /* CodeGenUtil. */safeQualifiedName(baseName) : null; + } + + public static String shortName(String qualifiedName) { + int index = qualifiedName.lastIndexOf("."); + return index != -1 ? qualifiedName.substring(index + 1) : qualifiedName; + } + + public static String safeQualifiedName(String qualifiedName) { + StringBuffer safeQualifiedName = new StringBuffer(); + for (StringTokenizer stringTokenizer = new StringTokenizer(qualifiedName, "."); + stringTokenizer.hasMoreTokens();) { + String name = stringTokenizer.nextToken(); + safeQualifiedName.append(CodeGenUtil.safeName(name)); + if (stringTokenizer.hasMoreTokens()) { + safeQualifiedName.append('.'); + } + } + return safeQualifiedName.toString(); + } + + protected static void printDiagnostic(Diagnostic diagnostic, String indent) { + System.out.print(indent); + System.out.println(diagnostic.getMessage()); + for (Iterator i = diagnostic.getChildren().iterator(); i.hasNext();) { + printDiagnostic((Diagnostic)i.next(), indent + " "); + } + } + + protected static void printUsage() { + System.out.println("Usage arguments:"); + System.out.println(" [ -targetDirectory ]"); + System.out.println(" [ -javaPackage ]"); + System.out.println(" "); + System.out.println(""); + System.out.println("For example:"); + System.out.println(""); + System.out.println(" generate somedir/somefile.wsdl"); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl new file mode 100644 index 0000000000..e3da5da20f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + /** + * .java + * + * This file was auto-generated from WSDL + * by the Apache Axis2 version: #axisVersion# #today# + */ + package ; + + import org.osoa.sca.annotations.Remotable; + import org.apache.tuscany.api.annotation.DataType; + + /* + * java interface + */ + + @Remotable + @DataType(name="commonj.sdo.DataObject") + public interface { + + + + + + + + /** + * Auto generated method signatures + * @param + */ + public void + ( + + , + ) throws java.rmi.RemoteException; + + + + + + /** + * Auto generated method signature + * @param + */ + + public void start( + + + , + ,final . callback) throws java.rmi.RemoteException; + + + + + + + + + /** + * Auto generated method signature + + *@param + + */ + public void + ( + + , + + ) throws java.rmi.RemoteException; + + + + + + // + } + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java new file mode 100644 index 0000000000..e679496509 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer; + +public class CustomerValue { + + public int getValue(String custId, String stockSymbol) { + return 0; + } + + public Customer getCustomerDetails(String custId) { + return new Customer(); + } + + public String noArgsServiceMethod() + { + return new String(); + } + + private void privateServiceMethod() + { + + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java new file mode 100644 index 0000000000..4b5a795f2c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import org.apache.tuscany.tools.java2wsdl.generate.account.Account; +import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer; + +public class CustomerWithAccount { + + private Customer customer = new Customer(); + + private Account[] accounts; + + public int getValue(String custId, String stockSymbol) { + return 123; + } + + public Customer getCustomerDetails(String custId) { + return customer; + } + + public Account getCustomerAccount(String custId, String accountId) { + return accounts[0]; + } + + public Account[] getAccounts() { + return accounts; + } + + public void setAccounts(Account[] accounts) { + this.accounts = accounts; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java new file mode 100644 index 0000000000..a72321c9b1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.File; + +import junit.framework.TestCase; + +/** + * A JUnit test case to test the Tuscany Java 2 WSDL Generation + */ +public class TuscanyJava2WSDLTestCase extends TestCase { + + /** + * setup the pre-requisites for the test case to run + * + * @exception Exception + */ + protected void setUp() throws Exception { + // System.out.println("inside setup"); + super.setUp(); + } + + /** + * @exception Exception + */ + protected void tearDown() throws Exception { + // System.out.println("inside tearDown"); + super.tearDown(); + } + + + /** + * Simple WSDL generation test. + */ + public void testSimpleWSDLGeneration() { + String[] arguments = new String[] { "-cn","org.apache.tuscany.tools.java2wsdl.generate.CustomerValue", + "-o", "target/java2wsdl-source", + "-xc", "org.apache.tuscany.tools.java2wsdl.generate.extra.GoldCustomer"}; + + + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CustomerValue.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + /** + * Test WSDL generation where a parameter Object[] is involved. + */ + public void testWsdlGeneration2() { + + String[] arguments = new String[] + { + "-cn", + "org.apache.tuscany.tools.java2wsdl.generate.CustomerWithAccount", + "-o", "target/java2wsdl-source", }; + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CustomerWithAccount.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + public void testWsdlGeneration_SDO_Static() + { + //tests for SDOs where XSD exist. Hence no XSDs must be generated + String[] arguments = new String[] { + "-cn", + "org.soapinterop.CreditScoreDocLit", + "-o", "target/java2wsdl-source", + "-ixsd", "[http://www.example.org/creditscore/doclit/," + + "http://www.example.org/creditscore/doclit/xsd]"}; + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CreditScoreDocLit.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + + + /** + * Test WSDL generation from a java interface and then generate the java + * interface using the generated WSDL. + */ + public void _testRoundTrip() { + // TODO implement round trip + // this should re-generate java interfaces from the generated wsdl + // and compile (?) the generated java code. + // fail(); + + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java new file mode 100644 index 0000000000..84d59164ee --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate.account; + +import java.math.BigDecimal; + +public class Account { + int accountType; + + String accountNo; + + BigDecimal balance; + + public String getAccountNo() { + return accountNo; + } + + public void setAccountNo(String accountNo) { + this.accountNo = accountNo; + } + + public int getAccountType() { + return accountType; + } + + public void setAccountType(int accountType) { + this.accountType = accountType; + } + + public BigDecimal getBalance() { + return balance; + } + + public void setBalance(BigDecimal balance) { + this.balance = balance; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java new file mode 100644 index 0000000000..a28399e7fe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate.customer; + +public class Customer { + private String name = ""; + + public int custType = 0; + + public String getName() { + return name; + } +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java new file mode 100644 index 0000000000..afc68a3217 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate.extra; + +import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer; + + + + +public class GoldCustomer extends Customer { + public String goldCustNumber = ""; + + public String getGoldCustNumber() { + return goldCustNumber; + } + + public void setGoldCustNumber(String goldCustNumber) { + this.goldCustNumber = goldCustNumber; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java new file mode 100644 index 0000000000..c3467cbabc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import junit.framework.TestCase; + +/** + * Test case for WSDL2Java + */ +public class WSDL2JavaGeneratorTestCase extends TestCase { + + public void testAccountService() { + + String basedir = System.getProperty("basedir"); + if (basedir == null) + basedir ="."; + + + String[] args=new String[] { "-targetDirectory", basedir + "/target/wsdl2java-source", + "-javaPackage", "org.apache.tuscany.tools.wsdl2java.generate.account", + basedir + "/src/test/resources/AccountService.wsdl"}; + + WSDL2JavaGenerator.main(args); + + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java new file mode 100644 index 0000000000..e9e8aa882a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.soapinterop; + +public interface CreditScoreDocLit { + public org.example.creditscore.doclit.CreditReport getCreditScore( + org.example.creditscore.doclit.Customer param0) throws java.rmi.RemoteException; + } + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/AccountService.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/AccountService.wsdl new file mode 100644 index 0000000000..e7be3ce5ba --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/AccountService.wsdl @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl new file mode 100644 index 0000000000..09d1a58589 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/helloworld.wsdl new file mode 100644 index 0000000000..051f604bb2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/helloworld.wsdl @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/interopdoc.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/interopdoc.wsdl new file mode 100644 index 0000000000..820c26ca34 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/interopdoc.wsdl @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/sequences.xsd b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/sequences.xsd new file mode 100644 index 0000000000..a565f3fa65 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/sequences.xsd @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/pom.xml new file mode 100644 index 0000000000..a5b5a65105 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/pom.xml @@ -0,0 +1,131 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.axis2.tools + parent + pom + Apache Tuscany Axis2 Tools + Tools for the Axis2 extension + + + + + osuosl.org + http://ftp.osuosl.org/pub/eclipse/tools/emf/maven2 + + true + + + + + + java2wsdl + wsdl2java + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubator-SNAPSHOT + compile + + + + org.apache.neethi + neethi + 2.0 + compile + + + + org.apache.ws.commons.axiom + axiom-api + 1.2.2 + + + xerces + xercesImpl + + + + + + xerces + xercesImpl + 2.8.1 + + + + org.apache.axis2 + axis2-java2wsdl + 1.1.1 + compile + + + + org.apache.axis2 + axis2-codegen + 1.1.1 + compile + + + + org.eclipse.emf + codegen + 2.2.1 + compile + + + + org.eclipse.emf + codegen-ecore + 2.2.1 + compile + + + + annogen + annogen + 0.1.0 + compile + + + + commons-logging + commons-logging + 1.1 + compile + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/pom.xml new file mode 100644 index 0000000000..6f48974b41 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/pom.xml @@ -0,0 +1,164 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.tools + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-wsdl2java + Apache Tuscany Axis2 WSDL2Java Tool + Apache Tuscany Axis2 WSDL2Java Tool + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + + + + stax + stax-api + + + + wsdl4j + wsdl4j + + + + org.apache.neethi + neethi + + + + org.apache.ws.commons.schema + XmlSchema + + + + org.apache.ws.commons.axiom + axiom-api + + + + xerces + xercesImpl + + + + org.apache.ws.commons.axiom + axiom-impl + + + + org.apache.axis2 + axis2-kernel + + + + org.apache.axis2 + axis2-java2wsdl + + + + org.apache.axis2 + axis2-codegen + + + + org.eclipse.emf + codegen + + + + org.eclipse.emf + codegen-ecore + + + + annogen + annogen + + + + commons-logging + commons-logging + + + + org.codehaus.woodstox + wstx-asl + + + + junit + junit + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.0 + + + add-test-source + generate-sources + + add-test-source + + + + target/sdo-source + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + 1.0-incubator-SNAPSHOT + + + generate-sdo + generate-test-sources + + ${basedir}/src/test/resources/CreditScoreDocLit.wsdl + org.example.creditscore.doclit + true + true + true + + + generate + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java new file mode 100644 index 0000000000..3cb699681c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java @@ -0,0 +1,435 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Map; + +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; + +/** + * This class encapsulates the parameters that effect the generation of the + * WSDL. For example they contain all user settings such as source class, + * target location etc. + * + */ +public class GenerationParameters implements TuscanyJava2WSDLConstants +{ + public static final String WSDL_FILENAME_SUFFIX = ".wsdl"; + public static final String XSD_IMPORT_DELIMITER = "[,]"; + + private Map cmdLineOptions = null; + private FileOutputStream outputFileStream = null; + private String sourceClassName = null; + + private ArrayList extraClasses; + private String attrFormDefault = null; + private String elementFormDefault = null; + private String targetNamespace = null; + private String targetNamespacePrefix = null; + private String schemaTargetNamespace = null; + private String schemaTargetNamespacePrefix = null; + private ClassLoader classLoader = null; + private String serviceName = null; + private String style = DOCUMENT; + private String use = LITERAL; + private String locationUri = DEFAULT_LOCATION_URL; + private Map schemaLocationMap = null; + + public GenerationParameters(Map cmdLineOptions) throws Exception + { + this.cmdLineOptions = cmdLineOptions; + loadParameters(); + } + + protected void loadParameters() throws Exception + { + initializeSourceClassName(); + resolveFileOutputStream(); + resolveClassLoader4InputClasspath(); + loadSchemaLocationMap(); + initializeOtherParams(); + } + + private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption) { + //short option gets precedence + Java2WSDLCommandLineOption option = null; + if (longOption != null) { + option = (Java2WSDLCommandLineOption) cmdLineOptions.get(longOption); + if (option != null) { + return option; + } + } + if (shortOption != null) { + option = (Java2WSDLCommandLineOption) cmdLineOptions.get(shortOption); + } + + return option; + } + + protected void initializeSourceClassName() throws Exception + { + Java2WSDLCommandLineOption option = + loadOption(CLASSNAME_OPTION, CLASSNAME_OPTION_LONG); + sourceClassName = option == null ? null : option.getOptionValue(); + + if (sourceClassName == null || sourceClassName.equals("")) { + throw new Exception("class name must be present!"); + } + } + + /** + * @throws Exception + */ + protected void resolveFileOutputStream() throws Exception + { + File outputFolder; + Java2WSDLCommandLineOption option = loadOption(OUTPUT_LOCATION_OPTION, + OUTPUT_LOCATION_OPTION_LONG); + String outputFolderName = option == null ? System.getProperty("user.dir") : option.getOptionValue(); + + outputFolder = new File(outputFolderName); + if (!outputFolder.exists()) { + outputFolder.mkdirs(); + } else if (!outputFolder.isDirectory()) { + throw new Exception("The specified location " + outputFolderName + "is not a folder"); + } + + option = loadOption(OUTPUT_FILENAME_OPTION, + OUTPUT_FILENAME_OPTION_LONG); + String outputFileName = option == null ? null : option.getOptionValue(); + //derive a file name from the class name if the filename is not specified + if (outputFileName == null) + { + outputFileName = Java2WSDLUtils.getSimpleClassName(sourceClassName) + WSDL_FILENAME_SUFFIX; + } + + //first create a file in the given location + File outputFile = new File(outputFolder, outputFileName); + try + { + if (!outputFile.exists()) + { + outputFile.createNewFile(); + } + outputFileStream = new FileOutputStream(outputFile); + } + catch (IOException e) + { + throw new Exception(e); + } + } + + protected void addToSchemaLocationMap(String optionValue) throws Exception + { + //option value will be of the form [namespace, schemalocation] + //hence we take the two substrings starting after '[' and upto ',' and + //starting after ',' and upto ']' + getSchemaLocationMap().put(optionValue.substring(1, optionValue.indexOf(COMMA)), + optionValue.substring(optionValue.indexOf(COMMA) + 1, optionValue.length() - 1)); + + + } + + protected void loadSchemaLocationMap() throws Exception + { + Java2WSDLCommandLineOption option = loadOption(IMPORT_XSD_OPTION, IMPORT_XSD_OPTION_LONG); + + if (option != null) + { + ArrayList optionValues = option.getOptionValues(); + + for ( int count = 0 ; count < optionValues.size() ; ++count ) + { + addToSchemaLocationMap(((String)optionValues.get(count)).trim()); + } + } + } + + protected void resolveClassLoader4InputClasspath() throws Exception + { + Java2WSDLCommandLineOption option = + loadOption(CLASSPATH_OPTION, CLASSPATH_OPTION_LONG); + + if (option != null) { + ArrayList optionValues = option.getOptionValues(); + URL[] urls = new URL[optionValues.size()]; + String[] classPathEntries = (String[]) optionValues.toArray(new String[optionValues.size()]); + + try { + for (int i = 0; i < classPathEntries.length; i++) { + String classPathEntry = classPathEntries[i]; + //this should be a file(or a URL) + if (Java2WSDLUtils.isURL(classPathEntry)) { + urls[i] = new URL(classPathEntry); + } else { + urls[i] = new File(classPathEntry).toURL(); + } + } + } catch (MalformedURLException e) { + throw new Exception(e); + } + + classLoader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader()); + + } else { + classLoader = Thread.currentThread().getContextClassLoader(); + } + } + + protected void initializeOtherParams() + { +// set the other parameters to the builder + Java2WSDLCommandLineOption option = loadOption(SCHEMA_TARGET_NAMESPACE_OPTION, + SCHEMA_TARGET_NAMESPACE_OPTION_LONG); + schemaTargetNamespace = (option == null) ? null : option.getOptionValue(); + + option = loadOption(SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION, + SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG); + schemaTargetNamespacePrefix = (option == null) ? null : option.getOptionValue(); + + option = loadOption(TARGET_NAMESPACE_OPTION, + TARGET_NAMESPACE_OPTION_LONG); + targetNamespace = (option == null) ? null : option.getOptionValue(); + + option = loadOption(TARGET_NAMESPACE_PREFIX_OPTION, + TARGET_NAMESPACE_PREFIX_OPTION_LONG); + targetNamespacePrefix = (option == null) ? null : option.getOptionValue(); + + option = loadOption(SERVICE_NAME_OPTION, + SERVICE_NAME_OPTION_LONG); + serviceName = (option == null) ? Java2WSDLUtils.getSimpleClassName(sourceClassName) : option.getOptionValue(); + + option = loadOption(STYLE_OPTION,STYLE_OPTION); + style = (option == null) ? null : option.getOptionValue(); + + + option = loadOption(LOCATION_OPTION, + LOCATION_OPTION); + locationUri = (option == null) ? null : option.getOptionValue(); + + option = loadOption(USE_OPTION,USE_OPTION); + use = (option == null) ? null : option.getOptionValue(); + + option = loadOption(ATTR_FORM_DEFAULT_OPTION, ATTR_FORM_DEFAULT_OPTION_LONG); + attrFormDefault = (option == null) ? null : option.getOptionValue(); + + option = loadOption(ELEMENT_FORM_DEFAULT_OPTION,ELEMENT_FORM_DEFAULT_OPTION_LONG); + elementFormDefault = option == null ? null : option.getOptionValue(); + + option = loadOption(TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION, + TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION_LONG); + extraClasses = option == null ? new ArrayList() : option.getOptionValues(); + } + + public ClassLoader getClassLoader() + { + return classLoader; + } + + public void setClassLoader(ClassLoader classLoader) + { + this.classLoader = classLoader; + } + + public String getLocationUri() + { + if ( locationUri == null ) + { + locationUri = DEFAULT_LOCATION_URL; + } + return locationUri; + } + + public void setLocationUri(String locationUri) + { + this.locationUri = locationUri; + } + + public FileOutputStream getOutputFileStream() + { + return outputFileStream; + } + + public void setOutputFileStream(FileOutputStream outputFileStream) + { + this.outputFileStream = outputFileStream; + } + + public String getSchemaTargetNamespace() throws Exception + { + if (schemaTargetNamespace == null + || schemaTargetNamespace.trim().equals("")) + { + this.schemaTargetNamespace = Java2WSDLUtils + .schemaNamespaceFromClassName(getSourceClassName(), getClassLoader()).toString(); + } + return schemaTargetNamespace; + } + + public void setSchemaTargetNamespace(String schemaTargetNamespace) + { + this.schemaTargetNamespace = schemaTargetNamespace; + } + + public String getSchemaTargetNamespacePrefix() + { + if (schemaTargetNamespacePrefix == null + || schemaTargetNamespacePrefix.trim().equals("")) + { + this.schemaTargetNamespacePrefix = SCHEMA_NAMESPACE_PRFIX; + } + + return schemaTargetNamespacePrefix; + } + + public void setSchemaTargetNamespacePrefix(String schemaTargetNamespacePrefix) + { + this.schemaTargetNamespacePrefix = schemaTargetNamespacePrefix; + } + + public String getServiceName() + { + if ( serviceName == null ) + { + serviceName = Java2WSDLUtils.getSimpleClassName(getSourceClassName()); + } + return serviceName; + } + + public void setServiceName(String serviceName) + { + this.serviceName = serviceName; + } + + public String getSourceClassName() + { + return sourceClassName; + } + + public void setSourceClassName(String sourceClassName) + { + this.sourceClassName = sourceClassName; + } + + public String getStyle() + { + if ( style == null ) + { + style = DOCUMENT; + } + return style; + } + + public void setStyle(String style) + { + this.style = style; + } + + public String getTargetNamespace() throws Exception + { + if ( targetNamespace == null ) { + targetNamespace = Java2WSDLUtils.namespaceFromClassName(this.sourceClassName, this.classLoader).toString(); + } + return targetNamespace; + } + + public void setTargetNamespace(String targetNamespace) + { + this.targetNamespace = targetNamespace; + } + + public String getTargetNamespacePrefix() + { + return targetNamespacePrefix; + } + + public void setTargetNamespacePrefix(String targetNamespacePrefix) + { + this.targetNamespacePrefix = targetNamespacePrefix; + } + + public String getUse() + { + if ( use == null ) + { + use = LITERAL; + } + return use; + } + + public void setUse(String use) + { + this.use = use; + } + + public Map getSchemaLocationMap() + { + if ( schemaLocationMap == null ) + { + schemaLocationMap = new Hashtable(); + } + return schemaLocationMap; + } + + public void setSchemaLocationMap(Map schemaLocationMap) { + this.schemaLocationMap = schemaLocationMap; + } + + public String getAttrFormDefault() { + if ( attrFormDefault == null ) + { + attrFormDefault = FORM_DEFAULT_QUALIFIED; + } + return attrFormDefault; + } + + public void setAttrFormDefault(String attrFormDefault) { + this.attrFormDefault = attrFormDefault; + } + + public String getElementFormDefault() { + if ( elementFormDefault == null ) + { + elementFormDefault = FORM_DEFAULT_QUALIFIED; + } + return elementFormDefault; + } + + public void setElementFormDefault(String elementFormDefault) { + this.elementFormDefault = elementFormDefault; + } + + public ArrayList getExtraClasses() { + return extraClasses; + } + + public void setExtraClasses(ArrayList extraClasses) { + this.extraClasses = extraClasses; + } +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java new file mode 100644 index 0000000000..8855c3f6e9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser; + +/** + * This class provides the tooling abstraction to Tuscany Java2WSDL and can be + * invoked from command line with the follwing options as with Axis2 Java2WSDL + * + */ +public class Java2WSDL { + /** + * @param args + */ + public static void main(String[] args) + { + //parse the cmd line args + Java2WSDLCommandLineOptionParser commandLineOptionParser = + new Java2WSDLCommandLineOptionParser(args); + // validate the arguments + validateCommandLineOptions(commandLineOptionParser); + + Java2WSDLGeneratorFactory.getInstance().createGenerator(). + generateWSDL(commandLineOptionParser.getAllOptions()); + + // Uncomment the following statement to directly run the Axis2 tool + // without + // runAxis2Tool(args); + } + + private static void runAxis2Tool(String[] args) { + org.apache.ws.java2wsdl.Java2WSDL.main(args); + } + + private static void validateCommandLineOptions(Java2WSDLCommandLineOptionParser parser) { + if (parser.getAllOptions().size() == 0) { + printUsage(); + } else if (parser.getInvalidOptions(new TuscanyJava2WSDLOptionsValidator()).size() > 0) { + printUsage(); + } + + } + + public static void printUsage() { + System.out.println("Usage java2wsdl -cn : class file name"); + System.out.println("-o : output file location"); + System.out.println("-cp : list of classpath entries - (urls)"); + System.out.println("-tn : target namespace"); + System.out.println("-tp : target namespace prefix"); + System.out.println("-stn : target namespace for schema"); + System.out.println("-stp : target namespace prefix for schema"); + System.out.println("-sn : service name"); + System.out.println("-of : output file name for the WSDL"); + System.out.println("-st : style for the WSDL"); + System.out.println("-u : use for the WSDL"); + System.out.println("-l : address of the port for the WSDL"); + System.out.println("-ixsd [, ] : schemas to be imported (and not generated)"); + System.out.println("-efd : Setting for elementFormDefault (defaults to qualified)"); + System.out.println("-afd : Setting for attributeFormDefault (defaults to qualified)"); + System.out.println("-xc : Extra class for which schematype must be generated. " + + "\t\tUse as : -xc class1 -xc class2 ..."); + System.exit(0); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java new file mode 100644 index 0000000000..3323113af4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.Map; + +/** + * This is the Java2WSDL Generator facade that will be used by Tuscany + * components for java to wsdl conversion. + * + */ +public interface Java2WSDLGenerator { + public void generateWSDL(String[] args); + + public void generateWSDL(Map commandLineOptions); + + public void addWSDLGenListener(WSDLGenListener l); + + public void removeWSDLGenListener(WSDLGenListener l); + + public Map getCommandLineOptions(); + + public void setCommandLineOptoins(Map cmdLineOpts); + + public OutputStream getOutputStream(); + + public void setOutputStream(OutputStream outStream); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java new file mode 100644 index 0000000000..e8f3db95b0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.Vector; + +/** + * Factory that creates Java2WSDL Generators. Presently the there is a Default + * Generator that wraps around the AXIS2 Java2WSDL implementation. The factory + * can be extended to create generators that wrap around other implementations + * if required. + */ + +public class Java2WSDLGeneratorFactory { + /* + * singleton instance of this factory class + */ + private static Java2WSDLGeneratorFactory factory = null; + + /** + * code for the default generator + */ + public static final int DEFAULT_GENERATOR = 0; + + /** + * Default Generator class name + */ + public static final String DEFAULT_GENERATOR_CLASSNAME = "org.apache.tuscany.tools.java2wsdl.generate.Java2WSDLGeneratorImpl"; + + /** + * list of generator classnames in a position that corresponds to their + * code. For example the default generator's code is 0 and hence this + * generator's classname is stored at index '0' of the list + */ + protected Vector generatorClassNames = new Vector(); + + /** + * @return the singleton instance of this generator factory + */ + public static Java2WSDLGeneratorFactory getInstance() { + if (factory == null) { + factory = new Java2WSDLGeneratorFactory(); + } + return factory; + } + + private Java2WSDLGeneratorFactory() { + generatorClassNames.addElement(DEFAULT_GENERATOR_CLASSNAME); + } + + public Java2WSDLGenerator createGenerator() { + return createGenerator(DEFAULT_GENERATOR); + } + + /** + * creates an instance of a Java2WSDL Generator based on the input type + * + * @param genType + * type of the generator to be created + * @return an instance of a Java2WSDL Generator + */ + public Java2WSDLGenerator createGenerator(int genType) { + try { + return (Java2WSDLGenerator) (Class.forName(generatorClassNames + .elementAt(genType)).newInstance()); + } catch (Exception e) { + System.out + .println(" Unable to create Java2WSDL generator due to ....."); + System.out.println(e); + return null; + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java new file mode 100644 index 0000000000..9d1a9df438 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java @@ -0,0 +1,239 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import org.apache.ws.java2wsdl.Java2WSDL; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser; +import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator; + +/** + * This is an implementation of the Java2WSDLGenerator facade. This + * implementation is a decorator around the Axis2 implementation of the + * Java2WSDL conversion. The WSDL generation is divided into phases that are + * stringed up as a template method. The phases are - User Input Validation - + * WSDL Java Model Generation - Serialization of WSDL Java Model The function of + * each phase is accomplished by delegation to the appropriate classes in Axis2. + * At the start and end of each phase an event is published to subcribers + * denoting the start and end of the phase. + * + * Such a spliting up of the Java2WSDL conversion into phases has been designed + * to enable interceptors to modify the model or apply transformations to the + * output. Typically the interceptors can subscribe to the start and end events + * of these phases and hence be able to intercept. + * + * Note: This class contains substantial AXIS2 Java2WSDL code refactored into + * it. These will be removed as and when the Axis2 code is fixed. + * + */ +public class Java2WSDLGeneratorImpl implements Java2WSDLGenerator, TuscanyJava2WSDLConstants +{ + private List genPhaseListeners = new Vector(); + private GenerationParameters genParams = null; + private Map commandLineOptions = null; + private TuscanyJava2WSDLBuilder java2WsdlBuilder; + private OutputStream outputStream = null; + + public Java2WSDLGeneratorImpl() + { + + } + + private void multicastGenPhaseCompletionEvent(int genPhase) { + WSDLGenEvent event = new WSDLGenEvent(this, genPhase); + Iterator iterator = genPhaseListeners.iterator(); + while (iterator.hasNext()) { + ((WSDLGenListener) iterator.next()).WSDLGenPhaseCompleted(event); + } + } + + private void initJava2WSDLBuilder() throws Exception + { +// Now we are done with loading the basic values - time to create the builder + java2WsdlBuilder = new TuscanyJava2WSDLBuilder(genParams); + } + + protected boolean validateInputArgs(String[] args) + { + boolean isValid = true; + Java2WSDLCommandLineOptionParser parser = new Java2WSDLCommandLineOptionParser(args); + if (parser.getAllOptions().size() == 0) { + Java2WSDL.printUsage(); + isValid = false; + } else if (parser.getInvalidOptions(new Java2WSDLOptionsValidator()) + .size() > 0) { + Java2WSDL.printUsage(); + isValid = false; + } + + if (isValid) + { + commandLineOptions = parser.getAllOptions(); + } + + return isValid; + } + + public boolean buildWSDLDocument() throws Exception + { + boolean isComplete = true; + initJava2WSDLBuilder(); + java2WsdlBuilder.buildWSDL(); + + return isComplete; + } + + public boolean serializeWSDLDocument() throws Exception { + boolean isComplete = true; + + if ( getOutputStream() == null ) + { + setOutputStream(genParams.getOutputFileStream()); + } + + java2WsdlBuilder.getWsdlDocument().serialize(getOutputStream()); + getOutputStream().flush(); + getOutputStream().close();; + + return isComplete; + } + + /* + * This is the template method that splits the Java2WSDL generation cycle + * into phase / steps. + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#generateWSDL(java.lang.String[]) + */ + public void generateWSDL(Map commandLineOptions) + { + try + { + // load the user options into an easy to access abstraction + genParams = new GenerationParameters(commandLineOptions); + + // if the WSDL Model generation was successul + if ( buildWSDLDocument() ) + { + // multicast event for generation of wsdl model + multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_CREATION); + // if the serialization of the generated (and fixed) model + // is successful + if (serializeWSDLDocument()) { + // multicast event for writing of the WSDL Model to + // supplied output stream + multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_WRITING); + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + + // TODO Auto-generated method stub + + } + + public void generateWSDL(String[] args) + { + // if the argument input are found to be valid + if (validateInputArgs(args)) + { + //multicast event for input args validation complete + multicastGenPhaseCompletionEvent(WSDLGenListener.INPUT_ARGS_VALIDATION); + generateWSDL(commandLineOptions); + } + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#addWSDLGenListener(tuscany.tools.WSDLGenListener) + */ + public void addWSDLGenListener(WSDLGenListener l) { + genPhaseListeners.add(l); + + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#removeWSDLGenListener(tuscany.tools.WSDLGenListener) + */ + public void removeWSDLGenListener(WSDLGenListener l) { + genPhaseListeners.remove(l); + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#getCommandLineOptions() + */ + public Map getCommandLineOptions() { + return commandLineOptions; + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#setCommandLineOptoins(java.util.Map) + */ + public void setCommandLineOptoins(Map cmdLineOpts) { + commandLineOptions = cmdLineOpts; + } + + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#getOutputStream() + */ + public OutputStream getOutputStream() { + // TODO Auto-generated method stub + return outputStream; + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#setOutputStream(java.io.OutputStream) + */ + public void setOutputStream(OutputStream outStream) { + outputStream = outStream; + } + + + public TuscanyJava2WSDLBuilder getJava2WsdlBuilder() + { + return java2WsdlBuilder; + } + + public void setJava2WsdlBuilder(TuscanyJava2WSDLBuilder java2WsdlBuilder) + { + this.java2WsdlBuilder = java2WsdlBuilder; + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java new file mode 100644 index 0000000000..67609445ae --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java @@ -0,0 +1,524 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.StringReader; +import java.lang.reflect.Constructor; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Vector; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sdo.util.SDOUtil; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaForm; +import org.apache.ws.commons.schema.XmlSchemaGroupBase; +import org.apache.ws.commons.schema.XmlSchemaImport; +import org.apache.ws.commons.schema.XmlSchemaInclude; +import org.apache.ws.commons.schema.XmlSchemaSequence; +import org.apache.ws.commons.schema.XmlSchemaType; +import org.apache.ws.commons.schema.utils.NamespaceMap; +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.codehaus.jam.JClass; +import org.codehaus.jam.JProperty; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.XSDHelper; + +public class SchemaBuilder implements TuscanyJava2WSDLConstants { + public static final String NAME_SPACE_PREFIX = "stn_"; + + private static int prefixCount = 1; + + public static final String MIXED = "mixed"; + + public static final String GROUP = "group"; + + protected String attrFormDefault = null; + + protected String elementFormDefault = null; + + protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); + + private Hashtable schemaMap = new Hashtable(); + + protected Hashtable targetNamespacePrefixMap = new Hashtable(); + + protected TuscanyTypeTable typeTable = new TuscanyTypeTable(); + + protected Map schemaLocationMap = null; + + private ClassLoader classLoader; + + protected SchemaBuilder(XmlSchemaCollection schemaCollection, + Hashtable schemaMap, + Hashtable nsPrefixMap, + TuscanyTypeTable typeTable, + String attrFormDef, + String eleFormDef, + Map schemaLocMap, + ClassLoader classLoader) { + this.schemaMap = schemaMap; + this.xmlSchemaCollection = schemaCollection; + this.targetNamespacePrefixMap = nsPrefixMap; + this.typeTable = typeTable; + this.schemaLocationMap = schemaLocMap; + this.classLoader = classLoader; + this.attrFormDefault = attrFormDef; + this.elementFormDefault = eleFormDef; + } + + private boolean isSDO(JClass javaType) throws Exception { + Class sdoClass = Class.forName(javaType.getQualifiedName(), + true, + classLoader); + return DataObject.class.isAssignableFrom(sdoClass); + } + + private void buildComplexTypeContents_JavaType(JClass javaType, + XmlSchemaComplexType complexType, + XmlSchema xmlSchema) throws Exception { + JProperty[] properties = javaType.getDeclaredProperties(); + + for (int i = 0; i < properties.length; i++) { + JProperty property = properties[i]; + String propertyName = property.getType().getQualifiedName(); + boolean isArryType = property.getType().isArrayType(); + if (isArryType) { + propertyName = property.getType().getArrayComponentType().getQualifiedName(); + } + + if (typeTable.isSimpleType(propertyName)) { + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(getCorrectName(property.getSimpleName())); + elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyName)); + ((XmlSchemaGroupBase) complexType.getParticle()).getItems().add(elt1); + if (isArryType) { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + } else { + QName schemaTypeName = null; + if (isArryType) { + schemaTypeName = generateSchema(property.getType().getArrayComponentType()); + } else { + schemaTypeName = generateSchema(property.getType()); + } + + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(getCorrectName(property.getSimpleName())); + elt1.setSchemaTypeName(schemaTypeName); + ((XmlSchemaGroupBase) complexType.getParticle()).getItems().add(elt1); + + if (isArryType) { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + + addImports(xmlSchema, + schemaTypeName); + } + } + } + + protected QName buildSchema_JavaType(JClass javaType) throws Exception { + QName schemaTypeName = typeTable.getComplexSchemaTypeName(javaType, this.classLoader); + if (schemaTypeName == null) { + String simpleName = javaType.getSimpleName(); + + String packageName = javaType.getContainingPackage().getQualifiedName(); + + String targetNameSpace = + Java2WSDLUtils.schemaNamespaceFromClassName(javaType.getQualifiedName(), this.classLoader) + .toString(); + + XmlSchema xmlSchema = getXmlSchema(targetNameSpace); + String targetNamespacePrefix = (String) targetNamespacePrefixMap.get(targetNameSpace); + + schemaTypeName = new QName(targetNameSpace, simpleName, targetNamespacePrefix); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); + complexType.setName(simpleName); + + XmlSchemaSequence sequence = new XmlSchemaSequence(); + complexType.setParticle(sequence); + + createGlobalElement(xmlSchema, + complexType, + schemaTypeName); + xmlSchema.getItems().add(complexType); + xmlSchema.getSchemaTypes().add(schemaTypeName, + complexType); + + // adding this type to the table + // typeTable.addComplexScheam(name, complexType.getQName()); + typeTable.addComplexSchemaType(targetNameSpace, + simpleName, + schemaTypeName); + buildComplexTypeContents_JavaType(javaType, + complexType, + xmlSchema); + } + return schemaTypeName; + } + + protected QName buildSchema_SDO(Type dataType) // throws Exception + { + QName schemaTypeName = typeTable.getComplexSchemaTypeName(dataType.getURI(), + dataType.getName()); + + if (schemaTypeName == null) { + // invoke XSDHelper to generate schema for this sdo type + XSDHelper xsdHelper = SDOUtil.createXSDHelper(SDOUtil.createTypeHelper()); + // it is better to check if XSDHelper can generate the schema + if (xsdHelper.isXSD(dataType)) { + // if schemalocations for xsd has been specified, include them + includeExtXSD(dataType); + } else { + List typeList = new Vector(); + typeList.add(dataType); + + // the xsdhelper returns a string that contains the schemas for this type + String schemaDefns = xsdHelper.generate(typeList, + schemaLocationMap); + + // extract the schema elements and store them in the schema map + extractSchemas(schemaDefns); + } + // since the XSDHelper will not return the type name, create it and store it in typetable + schemaTypeName = new QName(dataType.getURI(), dataType.getName(), generatePrefix()); + typeTable.addComplexSchemaType(dataType.getURI(), + dataType.getName(), + schemaTypeName); + + } + return schemaTypeName; + } + + public QName generateSchema(JClass javaType) throws Exception { + if (isSDO(javaType)) { + Type dataType = createDataObject(javaType).getType(); + return buildSchema_SDO(dataType); + } else { + return buildSchema_JavaType(javaType); + } + } + + private XmlSchema getXmlSchema(String targetNamespace) { + XmlSchema xmlSchema; + + if ((xmlSchema = (XmlSchema) schemaMap.get(targetNamespace)) == null) { + String targetNamespacePrefix = generatePrefix(); + + xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); + xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); + + targetNamespacePrefixMap.put(targetNamespace, + targetNamespacePrefix); + schemaMap.put(targetNamespace, + xmlSchema); + + NamespaceMap prefixmap = new NamespaceMap(); + prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, + TuscanyTypeTable.XML_SCHEMA_URI); + prefixmap.put(targetNamespacePrefix, + targetNamespace); + xmlSchema.setNamespaceContext(prefixmap); + } + return xmlSchema; + } + + /** + * JAM convert first name of an attribute into UpperCase as an example if there is a instance variable called foo in a bean , then Jam give that + * as Foo so this method is to correct that error + * + * @param wrongName + * @return the right name, using english as the locale for case conversion + */ + public static String getCorrectName(String wrongName) { + if (wrongName.length() > 1) { + return wrongName.substring(0, + 1).toLowerCase(Locale.ENGLISH) + + wrongName.substring(1, + wrongName.length()); + } else { + return wrongName.substring(0, + 1).toLowerCase(Locale.ENGLISH); + } + } + + private String addImports(XmlSchema xmlSchema, QName schemaTypeName) { + String prefix = null; + String[] prefixes = xmlSchema.getNamespaceContext().getDeclaredPrefixes(); + for (int count = 0; count < prefixes.length; ++count) { + if (schemaTypeName.getNamespaceURI(). + equals(xmlSchema.getNamespaceContext().getNamespaceURI(prefixes[count])) ) { + return prefixes[count]; + } + } + + // the following lines are executed only if a prefix was not found which implies that the + // schemaTypeName was not imported earlier and also it does not belong to the targetnamespace + String schemaLocation = null; + XmlSchemaImport importElement = new XmlSchemaImport(); + importElement.setNamespace(schemaTypeName.getNamespaceURI()); + xmlSchema.getItems().add(importElement); + prefix = generatePrefix(); + //it is safe to cast like this since it was this class that instantiated the + //NamespaceContext and assigned it to an instance of a NamespaceMap (see method getXmlSchema) + ((NamespaceMap)xmlSchema.getNamespaceContext()).put(prefix, + schemaTypeName.getNamespaceURI()); + + return prefix; + } + + private String formGlobalElementName(String typeName) { + String firstChar = typeName.substring(0, + 1); + return typeName.replaceFirst(firstChar, + firstChar.toLowerCase()); + } + + private void createGlobalElement(XmlSchema xmlSchema, + XmlSchemaComplexType complexType, + QName elementName) { + XmlSchemaElement globalElement = new XmlSchemaElement(); + globalElement.setSchemaTypeName(complexType.getQName()); + globalElement.setName(formGlobalElementName(complexType.getName())); + globalElement.setQName(elementName); + + xmlSchema.getItems().add(globalElement); + xmlSchema.getElements().add(elementName, + globalElement); + } + + private DataObject createDataObject(JClass sdoClass) throws Exception { + Class sdoType = Class.forName(sdoClass.getQualifiedName(), + true, + classLoader); + + Constructor constructor = sdoType.getDeclaredConstructor(new Class[0]); + constructor.setAccessible(true); + Object instance = constructor.newInstance(new Object[0]); + return (DataObject) instance; + } + + private String generatePrefix() { + return NAME_SPACE_PREFIX + prefixCount++; + } + + private void includeExtXSD(Type dataType) { + // now we know there is a type for which the xsd must come from outside + // create a schema for the namespace of this type and add an include in it for + // the xsd that is defined externally + XmlSchema xmlSchema = getXmlSchema(dataType.getURI()); + + // ideally there could be more than one external schema defintions for a namespace + // and hence schemalocations will be a list of locations + // List schemaLocations = (List)schemaLocationMap.get(dataType.getURI()); + + // since as per the specs the input to XSDHelper is a map of allowing + // only one schemalocation for a namespace. So for now this single location will be + // picked up and put into a list + List schemaLocations = new Vector(); + + if (schemaLocationMap.get(dataType.getURI()) != null) { + schemaLocations.add(schemaLocationMap.get(dataType.getURI())); + } + + if (schemaLocations.size() <= 0) { + schemaLocations.add(DEFAULT_SCHEMA_LOCATION); + } + + Iterator includesIterator = xmlSchema.getIncludes().getIterator(); + Iterator schemaLocIterator = schemaLocations.iterator(); + String aSchemaLocation = null; + boolean includeExists = false; + // include all external schema locations + while (schemaLocIterator.hasNext()) { + aSchemaLocation = (String) schemaLocIterator.next(); + while (includesIterator.hasNext()) { + if (!includeExists + && aSchemaLocation.equals(((XmlSchemaInclude) includesIterator.next()).getSchemaLocation())) { + includeExists = true; + } + } + + if (!includeExists) { + XmlSchemaInclude includeElement = new XmlSchemaInclude(); + includeElement.setSchemaLocation(aSchemaLocation); + xmlSchema.getIncludes().add(includeElement); + xmlSchema.getItems().add(includeElement); + } + } + + } + + private void extractSchemas(String schemaDefns) { + // load each schema element and add it to the schema map + + String token = getToken(schemaDefns); + int curIndex = schemaDefns.indexOf(token); + int nextIndex = schemaDefns.indexOf(token, + curIndex + token.length()); + + while (curIndex != -1) { + StringReader sr = null; + if (nextIndex != -1) + sr = new StringReader(schemaDefns.substring(curIndex, + nextIndex)); + else + sr = new StringReader(schemaDefns.substring(curIndex)); + + XmlSchemaCollection collection = new XmlSchemaCollection(); + XmlSchema aSchema = collection.read(sr, + null); + addSchemaToMap(aSchema); + + curIndex = nextIndex; + nextIndex = schemaDefns.indexOf(token, + curIndex + token.length()); + } + } + + private void addSchemaToMap(XmlSchema extractedSchema) { + // check if a Schema object already exists in schema map for targetNamespace of this schema element + // if it does then copy the contents of this schema element to the existing one, ensuring that + // duplicate elements are not created. i.e. before adding some child element like 'include' or 'import' + // check if it already exists, if it does don't add this + XmlSchema existingSchema = (XmlSchema) schemaMap.get(extractedSchema.getTargetNamespace()); + + if (existingSchema == null) { + extractedSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + extractedSchema.setElementFormDefault(getElementFormDefaultSetting()); + schemaMap.put(extractedSchema.getTargetNamespace(), + extractedSchema); + + } else { + copySchemaItems(existingSchema, + extractedSchema); + } + } + + private void copySchemaItems(XmlSchema existingSchema, XmlSchema aSchema) { + // items to copy are imports, includes, elements, types ... + // each item is checked if it is a duplicate entry and copied only if it isn't + Iterator itemsIterator = aSchema.getItems().getIterator(); + Object schemaObject = null; + XmlSchemaElement schemaElement = null; + XmlSchemaType schemaType = null; + XmlSchemaInclude schemaInclude = null; + QName qName = null; + List existingIncludes = getExistingIncludes(existingSchema); + + while (itemsIterator.hasNext()) { + schemaObject = itemsIterator.next(); + if (schemaObject instanceof XmlSchemaElement) { + schemaElement = (XmlSchemaElement) schemaObject; + qName = schemaElement.getQName(); + // if the element does not exist in the existing schema + if (existingSchema.getElementByName(qName) == null) { + // add it to the existing schema + existingSchema.getElements().add(qName, + schemaElement); + existingSchema.getItems().add(schemaElement); + } + } else if (schemaObject instanceof XmlSchemaType) { + schemaType = (XmlSchemaType) itemsIterator.next(); + qName = schemaType.getQName(); + // if the element does not exist in the existing schema + if (existingSchema.getElementByName(qName) == null) { + // add it to the existing schema + existingSchema.getSchemaTypes().add(qName, + schemaType); + existingSchema.getItems().add(schemaType); + // add imports + addImports(existingSchema, + qName); + } + } else if (schemaObject instanceof XmlSchemaInclude) { + schemaInclude = (XmlSchemaInclude) itemsIterator.next(); + if (!existingIncludes.contains(schemaInclude.getSchemaLocation())) { + existingSchema.getIncludes().add(schemaInclude); + existingSchema.getItems().add(schemaInclude); + } + } + } + } + + private List getExistingIncludes(XmlSchema xmlSchema) { + List includeSchemaLocations = new Vector(); + Iterator iterator = xmlSchema.getIncludes().getIterator(); + + while (iterator.hasNext()) { + includeSchemaLocations.add(((XmlSchemaInclude) iterator.next()).getSchemaLocation()); + } + return includeSchemaLocations; + } + + private XmlSchemaForm getAttrFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private XmlSchemaForm getElementFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private String getToken(String s) { + // get the schema element name eg. "); + writeSchemas(writer); + writer.write(""); + + XMLStreamReader xmlReader = XMLInputFactory.newInstance() + .createXMLStreamReader(new ByteArrayInputStream(writer.toString() + .getBytes())); + + StAXOMBuilder staxOMBuilders = new StAXOMBuilder(fac, xmlReader); + OMElement documentElement = staxOMBuilders.getDocumentElement(); + + + Iterator iterator = documentElement.getChildElements(); + while (iterator.hasNext()) { + wsdlTypes.addChild((OMNode) iterator.next()); + } + defintions.addChild(wsdlTypes); + } + + private void writeSchemas(StringWriter writer) { + Iterator iterator = schemaCollection.iterator(); + XmlSchema xmlSchema = null; + + while (iterator.hasNext()) { + xmlSchema = (XmlSchema) iterator.next(); + // typeIterator = xmlSchema.getSchemaTypes().getValues(); + /* + * while (typeIterator.hasNext()) { xmlSchema.getItems().add((XmlSchemaObject) typeIterator.next()); } + */ + xmlSchema.write(writer); + } + } + + private void generateMessages(OMFactory fac, OMElement definitions) throws Exception { + Hashtable namespaceMap = new Hashtable(); + String namespacePrefix = null; + String namespaceURI = null; + QName messagePartType = null; + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + + if (jmethod.isPublic()) { + // Request Message + OMElement requestMessge = fac.createOMElement(MESSAGE_LOCAL_NAME, + wsdl); + requestMessge.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName() + MESSAGE_SUFFIX, + null); + definitions.addChild(requestMessge); + + // only if a type for the message part has already been defined + if ((messagePartType = typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(), + jmethod.getSimpleName())) != null) { + namespaceURI = messagePartType.getNamespaceURI(); + // avoid duplicate namespaces + if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) { + namespacePrefix = generatePrefix(); + namespaceMap.put(namespaceURI, + namespacePrefix); + } + + OMElement requestPart = fac.createOMElement(PART_ATTRIBUTE_NAME, + wsdl); + requestMessge.addChild(requestPart); + requestPart.addAttribute(ATTRIBUTE_NAME, + "part1", + null); + + requestPart.addAttribute(ELEMENT_ATTRIBUTE_NAME, + namespacePrefix + COLON_SEPARATOR + + jmethod.getSimpleName(), + null); + } + + // only if a type for the message part has already been defined + if ((messagePartType = typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(), + jmethod.getSimpleName() + + RESPONSE)) != null) { + namespaceURI = messagePartType.getNamespaceURI(); + if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) { + namespacePrefix = generatePrefix(); + namespaceMap.put(namespaceURI, + namespacePrefix); + } + // Response Message + OMElement responseMessge = fac.createOMElement(MESSAGE_LOCAL_NAME, + wsdl); + responseMessge.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName() + RESPONSE_MESSAGE, + null); + definitions.addChild(responseMessge); + OMElement responsePart = fac.createOMElement(PART_ATTRIBUTE_NAME, + wsdl); + responseMessge.addChild(responsePart); + responsePart.addAttribute(ATTRIBUTE_NAME, + "part1", + null); + + responsePart.addAttribute(ELEMENT_ATTRIBUTE_NAME, + namespacePrefix + COLON_SEPARATOR + + jmethod.getSimpleName() + RESPONSE, + null); + } + } + } + + // now add these unique namespaces to the the definitions element + Enumeration enumeration = namespaceMap.keys(); + while (enumeration.hasMoreElements()) { + namespaceURI = (String) enumeration.nextElement(); + definitions.declareNamespace(namespaceURI, + (String) namespaceMap.get(namespaceURI)); + } + } + + /** + * Generate the porttypes + */ + private void generatePortType(OMFactory fac, OMElement defintions) { + JMethod jmethod = null; + OMElement operation = null; + OMElement message = null; + OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, + wsdl); + defintions.addChild(portType); + portType.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + PORT_TYPE_SUFFIX, + null); + // adding message refs + for (int i = 0; i < method.length; i++) { + jmethod = method[i]; + + if (jmethod.isPublic()) { + operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + portType.addChild(operation); + operation.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName(), + null); + + message = fac.createOMElement(IN_PUT_LOCAL_NAME, + wsdl); + message.addAttribute(MESSAGE_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + jmethod.getSimpleName() + + MESSAGE_SUFFIX, + null); + operation.addChild(message); + + if (!jmethod.getReturnType().isVoidType()) { + message = fac.createOMElement(OUT_PUT_LOCAL_NAME, + wsdl); + message.addAttribute(MESSAGE_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + + jmethod.getSimpleName() + RESPONSE_MESSAGE, + null); + operation.addChild(message); + } + } + } + + } + + /** + * Generate the service + */ + public void generateService(OMFactory fac, OMElement defintions) { + OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME, + wsdl); + defintions.addChild(service); + service.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName(), + null); + OMElement port = fac.createOMElement(PORT, + wsdl); + service.addChild(port); + port.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + SOAP11PORT, + null); + port.addAttribute(BINDING_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + BINDING_NAME_SUFFIX, + null); + addExtensionElement(fac, + port, + soap, + SOAP_ADDRESS, + LOCATION, + generationParams.getLocationUri() + generationParams.getServiceName()); + + port = fac.createOMElement(PORT, + wsdl); + service.addChild(port); + port.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + SOAP12PORT, + null); + port.addAttribute(BINDING_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + SOAP12BINDING_NAME_SUFFIX, + null); + addExtensionElement(fac, + port, + soap12, + SOAP_ADDRESS, + LOCATION, + generationParams.getLocationUri() + generationParams.getServiceName()); + } + + /** + * Generate the bindings + */ + private void generateBinding(OMFactory fac, OMElement defintions) throws Exception { + generateSoap11Binding(fac, + defintions); + generateSoap12Binding(fac, + defintions); + } + + private void generateSoap11Binding(OMFactory fac, OMElement defintions) throws Exception { + OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, + wsdl); + defintions.addChild(binding); + binding.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + BINDING_NAME_SUFFIX, + null); + binding.addAttribute("type", + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + PORT_TYPE_SUFFIX, + null); + + addExtensionElement(fac, + binding, + soap, + BINDING_LOCAL_NAME, + TRANSPORT, + TRANSPORT_URI, + STYLE, + generationParams.getStyle()); + + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + if (jmethod.isPublic()) { + OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + binding.addChild(operation); + + addExtensionElement(fac, + operation, + soap, + OPERATION_LOCAL_NAME, + SOAP_ACTION, + URN_PREFIX + COLON_SEPARATOR + jmethod.getSimpleName(), + STYLE, + generationParams.getStyle()); + operation.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName(), + null); + + OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + input, + soap, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(input); + + if (!jmethod.getReturnType().isVoidType()) { + OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + output, + soap, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(output); + } + } + } + } + + private void generateSoap12Binding(OMFactory fac, OMElement defintions) throws Exception { + OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, + wsdl); + defintions.addChild(binding); + binding.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + SOAP12BINDING_NAME_SUFFIX, + null); + binding.addAttribute("type", + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + PORT_TYPE_SUFFIX, + null); + + addExtensionElement(fac, + binding, + soap12, + BINDING_LOCAL_NAME, + TRANSPORT, + TRANSPORT_URI, + STYLE, + generationParams.getStyle()); + + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + + if (jmethod.isPublic()) { + OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + binding.addChild(operation); + operation.declareNamespace(URI_WSDL12_SOAP, + SOAP12_PREFIX); + + addExtensionElement(fac, + operation, + soap12, + OPERATION_LOCAL_NAME, + SOAP_ACTION, + URN_PREFIX + COLON_SEPARATOR + jmethod.getSimpleName(), + STYLE, + generationParams.getStyle()); + operation.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName(), + null); + + OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + input, + soap12, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(input); + + if (!jmethod.getReturnType().isVoidType()) { + OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + output, + soap12, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(output); + } + } + } + } + + private void addExtensionElement(OMFactory fac, + OMElement element, + OMNamespace namespace, + String name, + String att1Name, + String att1Value, + String att2Name, + String att2Value) { + OMElement soapbinding = fac.createOMElement(name, + namespace); + element.addChild(soapbinding); + soapbinding.addAttribute(att1Name, + att1Value, + null); + soapbinding.addAttribute(att2Name, + att2Value, + null); + } + + private void addExtensionElement(OMFactory fac, + OMElement element, + OMNamespace namespace, + String name, + String att1Name, + String att1Value) { + OMElement soapbinding = fac.createOMElement(name, + namespace); + element.addChild(soapbinding); + soapbinding.addAttribute(att1Name, + att1Value, + null); + } + + private String generatePrefix() { + return NAMESPACE_PREFIX + prefixCount++; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java new file mode 100644 index 0000000000..b23726f6fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Collection; + +import org.apache.axiom.om.OMElement; +import org.apache.ws.java2wsdl.Java2WSDLConstants; + +public class TuscanyJava2WSDLBuilder implements Java2WSDLConstants { + + private OutputStream out; + private String className; + private ClassLoader classLoader; + private String wsdlPrefix = "wsdl"; + + // these apply for the WSDL + private GenerationParameters generationParams; + + private OMElement wsdlDocument = null; + + public String getWsdlPrefix() { + return wsdlPrefix; + } + + public void setWsdlPrefix(String wsdlPrefix) { + this.wsdlPrefix = wsdlPrefix; + } + + public TuscanyJava2WSDLBuilder(GenerationParameters genParams) { + this.generationParams = genParams; + } + + /** + * Externally visible generator method + * + * @throws Exception + */ + public void buildWSDL() throws Exception { + ArrayList excludeOpeartion = new ArrayList(); + excludeOpeartion.add("init"); + excludeOpeartion.add("setOperationContext"); + excludeOpeartion.add("destroy"); + + TuscanyWSDLTypesGenerator typesGenerator = new TuscanyWSDLTypesGenerator(generationParams); + typesGenerator.setExcludeMethods(excludeOpeartion); + Collection schemaCollection = typesGenerator.buildWSDLTypes(); + + TuscanyJava2OMBuilder java2OMBuilder = + new TuscanyJava2OMBuilder(typesGenerator.getMethods(), schemaCollection, typesGenerator + .getTypeTable(), generationParams); + + wsdlDocument = java2OMBuilder.generateOM(); + } + + public OMElement getWsdlDocument() { + return wsdlDocument; + } + + public void setWsdlDocument(OMElement wsdlDocument) { + this.wsdlDocument = wsdlDocument; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java new file mode 100644 index 0000000000..cde870fff4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import org.apache.ws.java2wsdl.Java2WSDLConstants; + +/** + * This is a extension from the Axis2 Java2WSDLConstants to handle additions specific to Tuscany. + * This class can be done away with once Axis2 is also enhanced to support these + * additional options. + * + */ +public interface TuscanyJava2WSDLConstants extends Java2WSDLConstants +{ + public static final char OPEN_BRACKET = '['; + public static final char COMMA = ','; + public static final char CLOSE_BRACKET = ']'; + public static final String DEFAULT_SCHEMA_LOCATION = "*.xsd"; + public static final String SCHEMA_ELEMENT_NAME = "schema"; + + String FORM_DEFAULT_QUALIFIED = "qualified"; + String FORM_DEFAULT_UNQUALIFIED = "unqualified"; + + //short options + String IMPORT_XSD_OPTION = "ixsd"; //option for importing XSDs + String ATTR_FORM_DEFAULT_OPTION = "afd"; + String ELEMENT_FORM_DEFAULT_OPTION = "efd"; + String EXTRA_CLASSES_DEFAULT_OPTION = "xc"; + + //long options + String IMPORT_XSD_OPTION_LONG = "import_xsd"; //option for importing XSDs + String ATTR_FORM_DEFAULT_OPTION_LONG = "attributeFormDefault"; + String ELEMENT_FORM_DEFAULT_OPTION_LONG = "elementFormDefault"; + String EXTRA_CLASSES_DEFAULT_OPTION_LONG = "extraClasses"; +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java new file mode 100644 index 0000000000..6411327abf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.ArrayList; + +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; +import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator; + +/** + * This class is an extension from the Axis2 implementation in order to handle additional optoins + * specific to Tuscany. This class can be done away with once Axis2 is also enhanced to support these + * additional options. + * + */ +public class TuscanyJava2WSDLOptionsValidator extends Java2WSDLOptionsValidator implements + TuscanyJava2WSDLConstants { + public boolean isInvalid(Java2WSDLCommandLineOption option) { + boolean invalid; + String optionType = option.getOptionType(); + + invalid = !((IMPORT_XSD_OPTION).equalsIgnoreCase(optionType) + || (IMPORT_XSD_OPTION_LONG).equalsIgnoreCase(optionType) + || (TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION_LONG).equalsIgnoreCase(optionType) + || (TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION).equalsIgnoreCase(optionType) + || !super.isInvalid(option)); + + invalid = validateImportXSDOption(invalid, + option); + + return invalid; + } + + private boolean validateImportXSDOption(boolean invalid, Java2WSDLCommandLineOption option) { + String optionType = option.getOptionType(); + String schemaNSLocationPair = null; + + if (!invalid && (IMPORT_XSD_OPTION).equalsIgnoreCase(optionType) + || (IMPORT_XSD_OPTION_LONG).equalsIgnoreCase(optionType)) { + ArrayList optionValues = option.getOptionValues(); + + for (int count = 0; count < optionValues.size(); ++count) { + schemaNSLocationPair = ((String) optionValues.get(count)).trim(); + if ((schemaNSLocationPair.charAt(0) != OPEN_BRACKET) + || (schemaNSLocationPair.charAt(schemaNSLocationPair.length() - 1) != CLOSE_BRACKET) + || (schemaNSLocationPair.indexOf(COMMA) == -1)) + + { + System.out.println("Schema Namespace-Location pair option not specified properly!!"); + invalid = true; + } + } + } + + return invalid; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java new file mode 100644 index 0000000000..4f3371126d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java @@ -0,0 +1,410 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaForm; +import org.apache.ws.commons.schema.XmlSchemaImport; +import org.apache.ws.commons.schema.XmlSchemaInclude; +import org.apache.ws.commons.schema.XmlSchemaSequence; +import org.apache.ws.commons.schema.utils.NamespaceMap; +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.SchemaGenerator; +import org.apache.ws.java2wsdl.bytecode.MethodTable; +import org.codehaus.jam.JClass; +import org.codehaus.jam.JMethod; +import org.codehaus.jam.JParameter; +import org.codehaus.jam.JamClassIterator; +import org.codehaus.jam.JamService; +import org.codehaus.jam.JamServiceFactory; +import org.codehaus.jam.JamServiceParams; + + +public class TuscanySchemaGenerator implements TuscanyJava2WSDLConstants +{ + public static final String NAME_SPACE_PREFIX = "stn_"; + public static final String PERIOD_SEPARATOR = "."; + private static int prefixCount = 1; + + protected String attrFormDefault = null; + protected String elementFormDefault = null; + protected Hashtable targetNamespacePrefixMap = new Hashtable(); + protected Hashtable schemaMap = new Hashtable(); + protected Hashtable sdoAnnoMap = new Hashtable(); + protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); + private TuscanyTypeTable typeTable = new TuscanyTypeTable(); + protected SchemaBuilder schemaBuilder = null; + protected Map schemaLocationMap = null; + + private static final Log log = LogFactory.getLog(SchemaGenerator.class); + private ClassLoader classLoader; + private String className; + + // to keep loadded method using JAM + private JMethod methods []; + + //to store byte code method using Axis 1.x codes + private MethodTable methodTable; + private String schemaTargetNameSpace; + private String schema_namespace_prefix; + private Class clazz; + private ArrayList excludeMethods = new ArrayList(); + + public TuscanySchemaGenerator(ClassLoader loader, + String className, + String schematargetNamespace, + String schematargetNamespacePrefix, + Map schemaLocMap) + throws Exception + { + DataObjectUtil.initRuntime(); + this.classLoader = loader; + this.className = className; + clazz = Class.forName(className, true, loader); + methodTable = new MethodTable(clazz); + this.schemaTargetNameSpace = schematargetNamespace; + this.schema_namespace_prefix = schematargetNamespacePrefix; + this.schemaLocationMap = schemaLocMap; + + initializeSchemaMap(this.schemaTargetNameSpace, this.schema_namespace_prefix); + schemaBuilder = new SchemaBuilder(xmlSchemaCollection, + schemaMap, + targetNamespacePrefixMap, + typeTable, + getAttrFormDefault(), + getElementFormDefault(), + schemaLocMap, + this.classLoader ); + } + + /** + * Generates schema for all the parameters in method. First generates schema + * for all different parameter type and later refers to them. + * + * @return Returns XmlSchema. + * @throws Exception + */ + public Collection buildWSDLTypes() throws Exception + { + JamServiceFactory factory = JamServiceFactory.getInstance(); + JamServiceParams jam_service_parms = factory.createServiceParams(); + //setting the classLoder +// jam_service_parms.setParentClassLoader(factory.createJamClassLoader(classLoader)); + //it can posible to add the classLoader as well + jam_service_parms.addClassLoader(classLoader); + jam_service_parms.includeClass(className); + JamService service = factory.createService(jam_service_parms); + + JamClassIterator jClassIter = service.getClasses(); + //all most all the time the ittr will have only one class in it + while (jClassIter.hasNext()) + { + JClass jclass = (JClass) jClassIter.next(); + // serviceName = jclass.getSimpleName(); + //todo in the future , when we support annotation we can use this + //JAnnotation[] annotations = jclass.getAnnotations(); + + /** + * Schema genertaion done in two stage 1. Load all the methods and + * create type for methods parameters (if the parameters are Bean + * then it will create Complex types for those , and if the + * parameters are simple type which decribe in SimpleTypeTable + * nothing will happen) 2. In the next stage for all the methods + * messages and port types will be creteated + */ + methods = jclass.getDeclaredMethods(); + + // since we do not support overload + HashMap uniqueMethods = new HashMap(); + XmlSchemaComplexType methodSchemaType = null; + XmlSchemaSequence sequence = null; + QName methodPartSchemaTypeName = null; + for (int i = 0; i < methods.length; i++) + { + String methodName = methods[i].getSimpleName(); + JMethod jMethod = methods[i]; + // no need to think abt this method , since that is system + // config method + if (excludeMethods.contains(jMethod.getSimpleName())) { + continue; + } + //if (jMethod.getSimpleName().equals("init") + // || "setOperationContext".equals(jMethod.getSimpleName()) + // || "destroy".equals(jMethod.getSimpleName())) + // continue; + if (uniqueMethods.get(jMethod.getSimpleName()) != null) { + throw new Exception( + " Sorry we don't support methods overloading !!!! "); + } + + if (!jMethod.isPublic()) { + // no need to generate Schema for non public methods + continue; + } + + uniqueMethods.put(jMethod.getSimpleName(), jMethod); + JParameter [] paras = jMethod.getParameters(); + String parameterNames [] = null; + if (paras.length > 0) + { + parameterNames = methodTable.getParameterNames(methodName); + sequence = new XmlSchemaSequence(); + + //create the schema type for the method wrapper + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName()); + methodSchemaType.setParticle(sequence); + } + + for (int j = 0; j < paras.length; j++) + { + JParameter methodParameter = paras[j]; + JClass paraType = methodParameter.getType(); + generateSchemaForType(sequence, paraType, + ( parameterNames != null && parameterNames[j] != null )? parameterNames[j] : methodParameter.getSimpleName()); + } + // for its return type + JClass returnType = jMethod.getReturnType(); + QName methodReturnSchemaTypeName = null; + + if (!returnType.isVoidType()) + { + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE); + sequence = new XmlSchemaSequence(); + methodSchemaType.setParticle(sequence); + generateSchemaForType(sequence, returnType, "return"); + } + } + //generateWrapperElements(methods); + } + return schemaMap.values(); + } + + private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName) throws Exception + { + boolean isArrayType = type.isArrayType(); + if ( isArrayType ) + { + type = type.getArrayComponentType(); + } + + String classTypeName = type.getQualifiedName(); + + QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName); + if ( schemaTypeName == null ) + { + schemaTypeName = + schemaBuilder.generateSchema(type); + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + addImportORInclude((XmlSchema)schemaMap.get(schemaTargetNameSpace), schemaTypeName); + + } + else + { + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + } + + return schemaTypeName; + } + + private void addContentToMethodSchemaType(XmlSchemaSequence sequence, + QName schemaTypeName, + String paraName, + boolean isArray ) + { + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(paraName); + elt1.setSchemaTypeName(schemaTypeName); + sequence.getItems().add(elt1); + + if ( isArray ) + { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + } + + private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) + { + XmlSchema xmlSchema = (XmlSchema)schemaMap.get(schemaTargetNameSpace); + QName elementName = new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); + + XmlSchemaElement globalElement = new XmlSchemaElement(); + globalElement.setSchemaType(complexType); + globalElement.setName(formGlobalElementName(localPartName)); + globalElement.setQName(elementName); + + xmlSchema.getItems().add(globalElement); + xmlSchema.getElements().add(elementName, globalElement); + + typeTable.addComplexSchemaType(this.schemaTargetNameSpace, globalElement.getName(), elementName); + + return complexType; + } + + + private String formGlobalElementName(String typeName) + { + String firstChar = typeName.substring(0,1); + return typeName.replaceFirst(firstChar, firstChar.toLowerCase()); + } + + public TuscanyTypeTable getTypeTable() { + return typeTable; + } + + public JMethod[] getMethods() { + return methods; + } + + private String generatePrefix() { + return NAME_SPACE_PREFIX + prefixCount++; + } + + public void setExcludeMethods(ArrayList excludeMethods) { + this.excludeMethods = excludeMethods; + } + + private void initializeSchemaMap(String targetNamespace, String targetNamespacePrefix) + { + XmlSchema xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); + xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); + + targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix); + schemaMap.put(targetNamespace, xmlSchema); + + + NamespaceMap prefixmap = new NamespaceMap(); + prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, TuscanyTypeTable.XML_SCHEMA_URI); + prefixmap.put(targetNamespacePrefix, targetNamespace); + xmlSchema.setNamespaceContext(prefixmap); + } + + private void setFormDefaults() + { + + } + + public Hashtable getSdoAnnoMap() { + return sdoAnnoMap; + } + + public void setSdoAnnoMap(Hashtable sdoAnnoMap) { + this.sdoAnnoMap = sdoAnnoMap; + } + + private void addImportORInclude(XmlSchema xmlSchema, QName schemaTypeName) + { + //decide whether there must be an import or an include + if ( xmlSchema.getTargetNamespace().equals(schemaTypeName.getNamespaceURI()) ) + { + XmlSchema containingSchema = (XmlSchema)schemaMap.get(schemaTypeName.getNamespaceURI()); + //if the type is not defined in the Schema then include + if ( containingSchema.getTypeByName(schemaTypeName) == null ) + { + String schemaLocation = null; + if ( (schemaLocation = (String)schemaLocationMap.get(schemaTypeName.getNamespaceURI())) != null ) + { + schemaLocation = DEFAULT_SCHEMA_LOCATION; + } + + XmlSchemaInclude includeElement = new XmlSchemaInclude(); + includeElement.setSchemaLocation(schemaLocation); + + if ( !xmlSchema.getIncludes().contains(includeElement) ) + { + xmlSchema.getIncludes().add(includeElement); + } + } + } + else + { + if (!((NamespaceMap)xmlSchema.getNamespaceContext()).values(). + contains(schemaTypeName.getNamespaceURI())) + { + XmlSchemaImport importElement = new XmlSchemaImport(); + importElement.setNamespace(schemaTypeName.getNamespaceURI()); + xmlSchema.getItems().add(importElement); + ((NamespaceMap)xmlSchema.getNamespaceContext()). + put(generatePrefix(), schemaTypeName.getNamespaceURI()); + } + } + } + + private XmlSchemaForm getAttrFormDefaultSetting() + { + if ( FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault()) ) + { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } + else + { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private XmlSchemaForm getElementFormDefaultSetting() + { + if ( FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault()) ) + { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } + else + { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + public String getAttrFormDefault() { + return attrFormDefault; + } + + public void setAttrFormDefault(String attrFormDefault) { + this.attrFormDefault = attrFormDefault; + } + + public String getElementFormDefault() { + return elementFormDefault; + } + + public void setElementFormDefault(String elementFormDefault) { + this.elementFormDefault = elementFormDefault; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java new file mode 100644 index 0000000000..4abd7a7ce7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java @@ -0,0 +1,225 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.codehaus.jam.JClass; + +public class TuscanyTypeTable +{ + public static final String XML_SCHEMA_URI = "http://www.w3.org/2001/XMLSchema"; + public static final String XS_URI_PREFIX = "xs"; + public static final QName XS_QNAME = new QName(XML_SCHEMA_URI, "schema", XS_URI_PREFIX); + public static final String DELIMITER = "#"; + + private Hashtable simpleXSDTypes; + private Hashtable complexXSDTypes; + + public static String asQualifiedName(String uri, String typeName) + { + return (uri + DELIMITER + typeName); + } + + + public TuscanyTypeTable() + { + simpleXSDTypes = new Hashtable(); + complexXSDTypes = new Hashtable(); + populateSimpleXSDTypes(); + populateStdSDOTypes(); + } + + private void populateStdSDOTypes() + { + simpleXSDTypes.put("Boolean", + new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX)); + simpleXSDTypes.put("Byte", + new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX)); + simpleXSDTypes.put("Bytes", + new QName(XML_SCHEMA_URI, "hexBinary", XS_URI_PREFIX)); + simpleXSDTypes.put("Character", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("DataObject", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("Date", + new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX)); + simpleXSDTypes.put("Day", + new QName(XML_SCHEMA_URI, "gDay", XS_URI_PREFIX)); + simpleXSDTypes.put("Decimal", + new QName(XML_SCHEMA_URI, "decimal", XS_URI_PREFIX)); + simpleXSDTypes.put("Double", + new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX)); + simpleXSDTypes.put("Duration", + new QName(XML_SCHEMA_URI, "duration", XS_URI_PREFIX)); + simpleXSDTypes.put("Float", + new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX)); + simpleXSDTypes.put("Int", + new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX)); + simpleXSDTypes.put("Integer", + new QName(XML_SCHEMA_URI, "integer", XS_URI_PREFIX)); + simpleXSDTypes.put("Long", + new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX)); + simpleXSDTypes.put("Month", + new QName(XML_SCHEMA_URI, "gMonth", XS_URI_PREFIX)); + simpleXSDTypes.put("monthDay", + new QName(XML_SCHEMA_URI, "gMonthDay", XS_URI_PREFIX)); + simpleXSDTypes.put("Object", + new QName(XML_SCHEMA_URI, "anySimpleType", XS_URI_PREFIX)); + simpleXSDTypes.put("Short", + new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX)); + simpleXSDTypes.put("String", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("Strings", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("Time", + new QName(XML_SCHEMA_URI, "time", XS_URI_PREFIX)); + simpleXSDTypes.put("Year", + new QName(XML_SCHEMA_URI, "gYear", XS_URI_PREFIX)); + simpleXSDTypes.put("YearMonth", + new QName(XML_SCHEMA_URI, "gYearMonth", XS_URI_PREFIX)); + simpleXSDTypes.put("YearMonthDay", + new QName(XML_SCHEMA_URI, "date", XS_URI_PREFIX)); + simpleXSDTypes.put("URI", + new QName(XML_SCHEMA_URI, "anyURI", XS_URI_PREFIX)); + } + + private void populateSimpleXSDTypes() { + //todo pls use the types from org.apache.ws.commons.schema.constants.Constants + simpleXSDTypes.put("int", + new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.String", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("boolean", + new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX)); + simpleXSDTypes.put("float", + new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX)); + simpleXSDTypes.put("double", + new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX)); + simpleXSDTypes.put("short", + new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX)); + simpleXSDTypes.put("long", + new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX)); + simpleXSDTypes.put("byte", + new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX)); + simpleXSDTypes.put("char", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Integer", + new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Double", + new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Float", + new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Long", + new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Character", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Boolean", + new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Byte", + new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Short", + new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX)); + simpleXSDTypes.put("java.util.Date", + new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX)); + simpleXSDTypes.put("java.util.Calendar", + new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Object", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("java.math.BigDecimal", + new QName(XML_SCHEMA_URI, "decimal", XS_URI_PREFIX)); + + // Any types + simpleXSDTypes.put(OMElement.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put(ArrayList.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put(Vector.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put(List.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + } + + public QName getStdSdoType(String typename) + { + return (QName) simpleXSDTypes.get(typename); + } + + public QName getComplexSchemaTypeName(String sdoURI, String sdoTypeName) + { + return (QName) complexXSDTypes.get(asQualifiedName(sdoURI, sdoTypeName)); + } + + public QName getComplexSchemaTypeName(JClass javaClass, ClassLoader cl) throws Exception + { + String namespace = Java2WSDLUtils.schemaNamespaceFromClassName( + javaClass.getQualifiedName(), cl).toString(); + return (QName) complexXSDTypes.get(asQualifiedName(namespace, javaClass.getSimpleName())); + } + + public boolean isSimpleType(String typeName) + { + Iterator keys = simpleXSDTypes.keySet().iterator(); + while (keys.hasNext()) { + String s = (String) keys.next(); + if (s.equals(typeName)) { + return true; + } + } + return false; + } + + public QName getSimpleSchemaTypeName(String typename) + { + return (QName) simpleXSDTypes.get(typename); + } + + public void addSimpleSchemaType(String typeName, QName schemaType) + { + simpleXSDTypes.put(typeName, schemaType); + } + + + public void addComplexSchemaType(String namespaceURI, String name, QName schemaType) + { + complexXSDTypes.put(asQualifiedName(namespaceURI, name), schemaType); + } + + + public QName getQNamefortheType(String namespaceURI, String typeName) + { + if ( XML_SCHEMA_URI.equals(namespaceURI)) + { + return getSimpleSchemaTypeName(typeName); + } + else + { + return getComplexSchemaTypeName(namespaceURI, typeName); + } + } +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java new file mode 100644 index 0000000000..a742e8913d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java @@ -0,0 +1,373 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaForm; +import org.apache.ws.commons.schema.XmlSchemaImport; +import org.apache.ws.commons.schema.XmlSchemaInclude; +import org.apache.ws.commons.schema.XmlSchemaSequence; +import org.apache.ws.commons.schema.utils.NamespaceMap; +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.SchemaGenerator; +import org.apache.ws.java2wsdl.bytecode.MethodTable; +import org.codehaus.jam.JClass; +import org.codehaus.jam.JMethod; +import org.codehaus.jam.JParameter; +import org.codehaus.jam.JamClassIterator; +import org.codehaus.jam.JamService; +import org.codehaus.jam.JamServiceFactory; +import org.codehaus.jam.JamServiceParams; + +public class TuscanyWSDLTypesGenerator implements TuscanyJava2WSDLConstants { + public static final String NAME_SPACE_PREFIX = "stn_"; + + public static final String PERIOD_SEPARATOR = "."; + + private static int prefixCount = 1; + + protected GenerationParameters generationParams; + + protected Hashtable targetNamespacePrefixMap = new Hashtable(); + + protected Hashtable schemaMap = new Hashtable(); + + protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); + + private TuscanyTypeTable typeTable = new TuscanyTypeTable(); + + protected SchemaBuilder schemaBuilder = null; + + protected Map schemaLocationMap = null; + + private static final Log log = LogFactory.getLog(SchemaGenerator.class); + + // to keep loadded method using JAM + private JMethod methods[]; + + //to store byte code method using Axis 1.x codes + private MethodTable methodTable; + + private Class clazz; + + private ArrayList excludeMethods = new ArrayList(); + + public TuscanyWSDLTypesGenerator(GenerationParameters genParams) throws Exception { + DataObjectUtil.initRuntime(); + this.generationParams = genParams; + + clazz = Class.forName(generationParams.getSourceClassName(), + true, + generationParams.getClassLoader()); + methodTable = new MethodTable(clazz); + + initializeSchemaMap(generationParams.getSchemaTargetNamespace(), + generationParams.getSchemaTargetNamespacePrefix()); + schemaBuilder = new SchemaBuilder(xmlSchemaCollection, + schemaMap, + targetNamespacePrefixMap, + typeTable, + generationParams.getAttrFormDefault(), + generationParams.getElementFormDefault(), + generationParams.getSchemaLocationMap(), + generationParams.getClassLoader()); + } + + /** + * Generates schema for all the parameters in method. First generates schema + * for all different parameter type and later refers to them. + * + * @return Returns XmlSchema. + * @throws Exception + */ + public Collection buildWSDLTypes() throws Exception { + JamServiceFactory factory = JamServiceFactory.getInstance(); + JamServiceParams jam_service_parms = factory.createServiceParams(); + //setting the classLoder +// jam_service_parms.setParentClassLoader(factory.createJamClassLoader(classLoader)); + //it can posible to add the classLoader as well + jam_service_parms.addClassLoader(generationParams.getClassLoader()); + jam_service_parms.includeClass(generationParams.getSourceClassName()); + + for ( int count = 0 ; count < generationParams.getExtraClasses().size() ; ++count ) + { + jam_service_parms.includeClass((String)generationParams.getExtraClasses().get(count)); + } + + JamService service = factory.createService(jam_service_parms); + QName extraSchemaTypeName = null; + JamClassIterator jClassIter = service.getClasses(); + //all most all the time the ittr will have only one class in it + while (jClassIter.hasNext()) { + JClass jclass = (JClass) jClassIter.next(); + // serviceName = jclass.getSimpleName(); + //todo in the future , when we support annotation we can use this + //JAnnotation[] annotations = jclass.getAnnotations(); + + if ( jclass.getQualifiedName().equals(generationParams.getSourceClassName()) ) + { + /** + * Schema genertaion done in two stage 1. Load all the methods and + * create type for methods parameters (if the parameters are Bean + * then it will create Complex types for those , and if the + * parameters are simple type which decribe in SimpleTypeTable + * nothing will happen) 2. In the next stage for all the methods + * messages and port types will be creteated + */ + methods = jclass.getDeclaredMethods(); + //short the elements in the array + Arrays.sort(methods); + + // since we do not support overload + HashMap uniqueMethods = new HashMap(); + XmlSchemaComplexType methodSchemaType; + XmlSchemaSequence sequence = null; + + for (int i = 0; i < methods.length; i++) { + JMethod jMethod = methods[i]; + + String methodName = methods[i].getSimpleName(); + // no need to think abt this method , since that is system + // config method + if (excludeMethods.contains(jMethod.getSimpleName())) { + continue; + } + + if (uniqueMethods.get(jMethod.getSimpleName()) != null) { + throw new Exception( + " Sorry we don't support methods overloading !!!! "); + } + + if (!jMethod.isPublic()) { + // no need to generate Schema for non public methods + continue; + } + uniqueMethods.put(jMethod.getSimpleName(), jMethod); + //create the schema type for the method wrapper + + uniqueMethods.put(jMethod.getSimpleName(), jMethod); + JParameter [] paras = jMethod.getParameters(); + String parameterNames [] = null; + if (paras.length > 0) { + parameterNames = methodTable.getParameterNames(methodName); + sequence = new XmlSchemaSequence(); + + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName()); + methodSchemaType.setParticle(sequence); + } + + for (int j = 0; j < paras.length; j++) { + JParameter methodParameter = paras[j]; + JClass paraType = methodParameter.getType(); + generateSchemaForType(sequence, paraType, + (parameterNames != null && parameterNames[j] != null) ? parameterNames[j] : methodParameter.getSimpleName()); + } + // for its return type + JClass returnType = jMethod.getReturnType(); + + if (!returnType.isVoidType()) { + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE); + sequence = new XmlSchemaSequence(); + methodSchemaType.setParticle(sequence); + generateSchemaForType(sequence, returnType, "return"); + } + } + } + else + { + //generate the schema type for extra classes + extraSchemaTypeName = typeTable.getSimpleSchemaTypeName(jclass.getQualifiedName()); + if (extraSchemaTypeName == null) + { + extraSchemaTypeName = schemaBuilder.generateSchema(jclass); + } + } + } + return schemaMap.values(); + } + + private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName) throws Exception { + boolean isArrayType = type.isArrayType(); + if (isArrayType) { + type = type.getArrayComponentType(); + } + + String classTypeName = type.getQualifiedName(); + + QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName); + if (schemaTypeName == null) { + schemaTypeName = schemaBuilder.generateSchema(type); + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + addImportORInclude((XmlSchema) schemaMap.get(generationParams.getSchemaTargetNamespace()), + schemaTypeName); + + } else { + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + } + + return schemaTypeName; + } + + private void addContentToMethodSchemaType(XmlSchemaSequence sequence, + QName schemaTypeName, + String paraName, + boolean isArray) { + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(paraName); + elt1.setSchemaTypeName(schemaTypeName); + sequence.getItems().add(elt1); + + if (isArray) { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + } + + private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) throws Exception { + XmlSchema xmlSchema = (XmlSchema) schemaMap.get(generationParams.getSchemaTargetNamespace()); + QName elementName = new QName(generationParams.getSchemaTargetNamespace(), + localPartName, + generationParams.getSchemaTargetNamespacePrefix()); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); + + XmlSchemaElement globalElement = new XmlSchemaElement(); + globalElement.setSchemaType(complexType); + globalElement.setName(formGlobalElementName(localPartName)); + globalElement.setQName(elementName); + + xmlSchema.getItems().add(globalElement); + xmlSchema.getElements().add(elementName, + globalElement); + + typeTable.addComplexSchemaType(generationParams.getSchemaTargetNamespace(), + globalElement.getName(), + elementName); + + return complexType; + } + + private String formGlobalElementName(String typeName) { + String firstChar = typeName.substring(0, + 1); + return typeName.replaceFirst(firstChar, + firstChar.toLowerCase()); + } + + public TuscanyTypeTable getTypeTable() { + return typeTable; + } + + public JMethod[] getMethods() { + return methods; + } + + private String generatePrefix() { + return NAME_SPACE_PREFIX + prefixCount++; + } + + public void setExcludeMethods(ArrayList excludeMethods) { + this.excludeMethods = excludeMethods; + } + + private void initializeSchemaMap(String targetNamespace, String targetNamespacePrefix) { + XmlSchema xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); + xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); + + targetNamespacePrefixMap.put(targetNamespace, + targetNamespacePrefix); + schemaMap.put(targetNamespace, + xmlSchema); + + NamespaceMap prefixmap = new NamespaceMap(); + prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, + TuscanyTypeTable.XML_SCHEMA_URI); + prefixmap.put(targetNamespacePrefix, + targetNamespace); + xmlSchema.setNamespaceContext(prefixmap); + } + + + private void addImportORInclude(XmlSchema xmlSchema, QName schemaTypeName) { + //decide whether there must be an import or an include + if (xmlSchema.getTargetNamespace().equals(schemaTypeName.getNamespaceURI())) { + XmlSchema containingSchema = (XmlSchema) schemaMap.get(schemaTypeName.getNamespaceURI()); + //if the type is not defined in the Schema then include + if (containingSchema.getTypeByName(schemaTypeName) == null) { + String schemaLocation = null; + if ((schemaLocation = (String) schemaLocationMap.get(schemaTypeName.getNamespaceURI())) != null) { + schemaLocation = DEFAULT_SCHEMA_LOCATION; + } + + XmlSchemaInclude includeElement = new XmlSchemaInclude(); + includeElement.setSchemaLocation(schemaLocation); + + if (!xmlSchema.getIncludes().contains(includeElement)) { + xmlSchema.getIncludes().add(includeElement); + } + } + } else { + if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values() + .contains(schemaTypeName.getNamespaceURI())) { + XmlSchemaImport importElement = new XmlSchemaImport(); + importElement.setNamespace(schemaTypeName.getNamespaceURI()); + xmlSchema.getItems().add(importElement); + ((NamespaceMap) xmlSchema.getNamespaceContext()).put(generatePrefix(), + schemaTypeName.getNamespaceURI()); + } + } + } + + private XmlSchemaForm getAttrFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(generationParams.getAttrFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private XmlSchemaForm getElementFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(generationParams.getElementFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java new file mode 100644 index 0000000000..26b3d092de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.EventObject; + +public class WSDLGenEvent extends EventObject { + private int generationPhase = WSDLGenListener.UNKNOWN; + + public WSDLGenEvent(Object source, int genPhase) { + super(source); + this.generationPhase = genPhase; + } + + public int getGenerationPhase() { + return generationPhase; + } + + public void setGenerationPhase(int generationPhase) { + this.generationPhase = generationPhase; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java new file mode 100644 index 0000000000..788d162f34 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +public interface WSDLGenListener { + public static int UNKNOWN = 0; + + public static int INPUT_ARGS_PARSING = 1; + + public static int INPUT_ARGS_VALIDATION = 2; + + public static int WSDL_MODEL_CREATION = 3; + + public static int WSDL_MODEL_WRITING = 4; + + public static String[] phaseAsString = { "Unknown", + "Input Arguments Parsing", "Input Arguments Validation", + "WSDL Model Creation", "WSDL Model Writing" }; + + public void WSDLGenPhaseStarted(WSDLGenEvent event); + + public void WSDLGenPhaseCompleted(WSDLGenEvent event); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java new file mode 100644 index 0000000000..b30b8cd62b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java @@ -0,0 +1,143 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.util; + +import java.util.ArrayList; +import java.util.List; + +public class XMLNameUtil { + + /** + * Returns a valid Java name from an XML Name. + * + * @param name + * @param isUpperCase + * @return a valid Java name from an XML Name + */ + public static String getJavaNameFromXMLName(String name, boolean isUpperCase) { + List parsedName = parseName(name, '_'); + StringBuilder result = new StringBuilder(64 * parsedName.size()); + for (String nameComponent: parsedName) { + if (nameComponent.length() > 0) { + if (result.length() > 0 || isUpperCase) { + result.append(Character.toUpperCase(nameComponent.charAt(0))); + result.append(nameComponent.substring(1)); + } else { + result.append(nameComponent); + } + } + } + + if (result.length() == 0) { + return "_"; + } + if (Character.isJavaIdentifierStart(result.charAt(0))) { + return isUpperCase ? result.toString() : decapitalizeName(result.toString()); + } + return "_" + result; + } + + /** + * Decapitalize a name. + * @param name + * @return a decapitalized name + */ + public static String decapitalizeName(String name) { + if (name.length() == 0) { + return name; + } else { + String lowerName = name.toLowerCase(); + int i; + for (i = 0; i < name.length(); i++) { + if (name.charAt(i) == lowerName.charAt(i)) { + break; + } + } + if (i > 1 && i < name.length()) { + --i; + } + return name.substring(0, i).toLowerCase() + name.substring(i); + } + } + + /** + * Parse the given name. + * + * @param sourceName + * @param separator + * @return some stuff parsed from the name + */ + private static List parseName(String sourceName, char separator) { + List result = new ArrayList(); + if (sourceName != null) { + StringBuilder currentWord = new StringBuilder(64); + boolean lastIsLower = false; + int index; + int length; + for (index = 0, length = sourceName.length(); index < length; ++index) { + char curChar = sourceName.charAt(index); + if (!Character.isJavaIdentifierPart(curChar)) { + curChar = separator; + } + if (Character.isUpperCase(curChar) + || (!lastIsLower && Character.isDigit(curChar)) + || curChar == separator) { + + if (lastIsLower && currentWord.length() > 1 + || curChar == separator && currentWord.length() > 0) { + result.add(currentWord.toString()); + currentWord = new StringBuilder(64); + } + lastIsLower = false; + } else { + if (!lastIsLower) { + int currentWordLength = currentWord.length(); + if (currentWordLength > 1) { + char lastChar = currentWord.charAt(--currentWordLength); + currentWord.setLength(currentWordLength); + result.add(currentWord.toString()); + currentWord = new StringBuilder(64); + currentWord.append(lastChar); + } + } + lastIsLower = true; + } + + if (curChar != separator) { + currentWord.append(curChar); + } + } + + result.add(currentWord.toString()); + } + return result; + } + + /** + * Return an EPackage name for the given namespace. + * + * @param namespace + * @return an EPackage name for the given namespace + */ + public static String getPackageNameFromNamespace(String namespace) { + return org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder.getDefaultPackageName(namespace); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java new file mode 100644 index 0000000000..22383e99db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java @@ -0,0 +1,222 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.axis2.description.AxisMessage; +import org.apache.axis2.description.AxisOperation; +import org.apache.axis2.util.FileWriter; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.emitter.JavaEmitter; +import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter; +import org.apache.axis2.wsdl.databinding.TypeMapper; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import static org.apache.tuscany.tools.java2wsdl.util.XMLNameUtil.getJavaNameFromXMLName; + +/** + * Overrides the Axis2 JavaEmitter to generate unwrapped methods. + */ +public class JavaInterfaceEmitter extends JavaEmitter { + + private CodeGenConfiguration codegenConfiguration; + private TypeMapper typeMapper; + + public void setCodeGenConfiguration(CodeGenConfiguration configuration) { + super.setCodeGenConfiguration(configuration); + codegenConfiguration=configuration; + } + + public void setMapper(TypeMapper typeMapper) { + super.setMapper(typeMapper); + this.typeMapper = typeMapper; + } + + private List getParameterElementList(Document doc, AxisMessage message, boolean wrapped) { + List parameterElementList = new ArrayList(); + + if (message != null && message.getElementQName()!=null) { + + SDODataBindingTypeMappingEntry typeMappingEntry = + (SDODataBindingTypeMappingEntry)this.typeMapper.getTypeMappingObject(message.getElementQName()); + List typeMappings; + if (wrapped) { + typeMappings = (List)typeMappingEntry.getPropertyClassNames(); + } else { + typeMappings = new ArrayList(); + typeMappings.add(typeMappingEntry.getClassName()); + } + + for (int i=0; i> Generating Java class " + packageName + "." + className); + File outputFile = FileWriter.createClassFile(this.codegenConfiguration.getOutputLocation(), + packageName, className, ".java"); + if (outputFile.exists()) { + outputFile.delete(); + } + + writeClass(interfaceModel, interfaceWriter); + } + + protected String makeJavaClassName(String word) { + //return XMLNameUtil.getJavaNameFromXMLName(word, true); + return getJavaNameFromXMLName(word, true); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java new file mode 100644 index 0000000000..b68277566a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java @@ -0,0 +1,230 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import static org.apache.tuscany.tools.java2wsdl.util.XMLNameUtil.getPackageNameFromNamespace; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Binding; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.PortType; +import javax.wsdl.Service; +import javax.wsdl.WSDLException; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; +import org.apache.axis2.util.XMLUtils; +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension; +import org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension; +import org.apache.axis2.wsdl.codegen.extension.PackageFinder; +import org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension; +import org.apache.axis2.wsdl.databinding.JavaTypeMapper; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +public class JavaInterfaceGenerator { + + private List codegenExtensions = new ArrayList(); + private List codegenConfigurations= new LinkedList(); + + + + + public JavaInterfaceGenerator(String uri, String ports[], String outputLocation, String packageName, + Map typeMapping) throws CodeGenerationException { + + Definition definition; + try { + definition = readWSDL(uri); + } catch (WSDLException e) { + throw new CodeGenerationException(e); + } + + HashSet interestedPorts= ports == null ? null : new HashSet(Arrays.asList(ports)); + + // Service service=(Service)definition.getServices().values().().next(); + + HashSet donePortTypes= new HashSet(); + + for (Iterator sIter = definition.getServices().values().iterator(); sIter.hasNext(); ) { + Service service = (Service) sIter.next(); + + QName serviceQname = service.getQName(); + for (Iterator pIter= service.getPorts().values().iterator(); pIter.hasNext(); ) { + Port port= (Port) pIter.next(); + if(interestedPorts != null && ! interestedPorts.contains(port.getName())) continue;//not iterested. + PortType portType= getPortType(port); + if(null == portType) continue; // not connected. + QName pQName= portType.getQName(); + if(donePortTypes.contains(pQName)) continue; //allready did it. + donePortTypes.add(pQName); + + if (packageName == null) { + + packageName = getPackageNameFromNamespace(definition.getTargetNamespace()); + } + JavaTypeMapper typeMapper = new JavaTypeMapper(); + for (Map.Entry e : typeMapping.entrySet()) { + typeMapper.addTypeMappingObject(e.getKey(), e.getValue()); + } + AxisService axisService; + try { + axisService = new WSDL11ToAxisServiceBuilder(definition, serviceQname, port.getName()).populateService(); + } catch (AxisFault e) { + throw new CodeGenerationException(e); + } + axisService.setName(port.getBinding().getPortType().getQName().getLocalPart()); + CodeGenConfiguration codegenConfiguration = new CodeGenConfiguration(Collections.EMPTY_MAP); + codegenConfigurations.add(codegenConfiguration); + codegenConfiguration.setAxisService(axisService); + codegenConfiguration.setAdvancedCodeGenEnabled(false); + codegenConfiguration.setAsyncOn(false); + codegenConfiguration.setDatabindingType("sdo"); + codegenConfiguration.setGenerateAll(true); + codegenConfiguration.setGenerateDeployementDescriptor(false); + codegenConfiguration.setOutputLanguage("java"); + codegenConfiguration.setOutputLocation(new File(outputLocation)); + codegenConfiguration.setPackageName(packageName); + codegenConfiguration.setPackClasses(false); + codegenConfiguration.setPolicyMap(Collections.EMPTY_MAP); + codegenConfiguration.setPortName(port.getName()); + codegenConfiguration.setServerSide(false); + codegenConfiguration.setServiceName(service.getQName().getLocalPart()); + codegenConfiguration.setSyncOn(true); + codegenConfiguration.setTypeMapper(typeMapper); + codegenConfiguration.setWriteMessageReceiver(false); + codegenConfiguration.setWriteTestCase(false); + addExtension(new WSDLValidatorExtension(), codegenConfiguration); + addExtension(new PackageFinder(), codegenConfiguration); + addExtension(new SDODataBindingCodegenExtension(typeMapper), codegenConfiguration); + addExtension(new DefaultDatabindingExtension(), codegenConfiguration); + } + } + } + + + private PortType getPortType(Port port) { + Binding binding = port.getBinding(); + if(null != binding){ + return binding.getPortType(); + } + return null; + + } + + + @SuppressWarnings("unchecked") + private void addExtension(CodeGenExtension ext, CodeGenConfiguration codegenConfiguration) { + //ext.init(codegenConfiguration); + codegenExtensions.add(new Object[]{ext, codegenConfiguration}); + } + + public void generate() throws CodeGenerationException { + try { + for (int i = 0; i < codegenExtensions.size(); i++) { + //CodeGenExtension + Object[] pair = (Object[])codegenExtensions.get(i); + + CodeGenExtension cge= (CodeGenExtension) pair[0]; + CodeGenConfiguration cgf= (CodeGenConfiguration)pair[1]; + + cge.engage(cgf); + + } + + for(CodeGenConfiguration codegenConfiguration : codegenConfigurations){ + JavaInterfaceEmitter emitter = new JavaInterfaceEmitter(); + emitter.setCodeGenConfiguration(codegenConfiguration); + emitter.setMapper(codegenConfiguration.getTypeMapper()); + + emitter.writeInterface(false); + } + + } catch (Exception e) { + throw new CodeGenerationException(e); + } + } + + /** + * Read the WSDL file + * @param uri + * @return + * @throws WSDLException + */ + private Definition readWSDL(String uri) throws WSDLException { + + WSDLReader reader = + WSDLFactory.newInstance().newWSDLReader(); + reader.setFeature("javax.wsdl.importDocuments", true); + + File file = new File(uri); + String baseURI; + + if (uri.startsWith("http://")){ + baseURI = uri; + } else{ + if(file.getParentFile() == null){ + try { + baseURI = new File(".").getCanonicalFile().toURI().toString(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } else { + baseURI = file.getParentFile().toURI().toString(); + } + } + + Document doc; + try { + doc = XMLUtils.newDocument(uri); + } catch (ParserConfigurationException e) { + throw new WSDLException(WSDLException.PARSER_ERROR, + "Parser Configuration Error", + e); + } catch (SAXException e) { + throw new WSDLException(WSDLException.PARSER_ERROR, + "Parser SAX Error", + e); + + } catch (IOException e) { + throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e); + } + + return reader.readWSDL(baseURI, doc); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java new file mode 100644 index 0000000000..cb413bca50 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.io.File; + +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter; + +/** + * @author lresende + */ +public class RemotableInterfaceWritter extends InterfaceWriter { + private static final String REMOTABLE_INTERFACE_TEMPLATE="/RemotableInterfaceTemplate.xsl"; + + public RemotableInterfaceWritter(String outputFileLocation) { + super(outputFileLocation); + } + + public RemotableInterfaceWritter(File outputFileLocation, String language) { + super(outputFileLocation, language); + } + + /** + * Loads the template. + */ + @Override + public void loadTemplate() throws CodeGenerationException { + // the default behavior for the class writers is to use the property map from the languge specific types + // The properties are arranged in the following order + // .* .template=, + + //overrida original behaviour to always load the template we specified + this.xsltStream = this.getClass().getResourceAsStream(REMOTABLE_INTERFACE_TEMPLATE); + + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java new file mode 100644 index 0000000000..075959f985 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.extension.AbstractDBProcessingExtension; +import org.apache.axis2.wsdl.databinding.TypeMapper; + +/** + * SDO data binding codegen extension. + */ +public class SDODataBindingCodegenExtension extends AbstractDBProcessingExtension { + + private TypeMapper typeMapper; + + public SDODataBindingCodegenExtension(TypeMapper typeMapper) { + this.typeMapper=typeMapper; + } + + protected boolean testFallThrough(String dbFrameworkName) { + return !dbFrameworkName.equals("sdo"); + } + +// public void engage() { +// if (testFallThrough(configuration.getDatabindingType())) { +// return; +// } +// +// // Set the type mapper into the config +// configuration.setTypeMapper(typeMapper); +// +// } + + public void engage(CodeGenConfiguration configuration) throws CodeGenerationException { + // TODO Auto-generated method stub + if (testFallThrough(configuration.getDatabindingType())) { + return; + } + + // Set the type mapper into the config + configuration.setTypeMapper(typeMapper); + + + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java new file mode 100644 index 0000000000..2d81ef12bf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.util.List; + +/** + * This represents a type mapping entry, used by the JavaInterfaceEmitter to generate + * method signatures. + */ +public class SDODataBindingTypeMappingEntry { + + private final boolean anonymous; + private final List propertyClassNames; + private final String className; + + public SDODataBindingTypeMappingEntry(String className, boolean anonymous, List propertyClassNames) { + this.className = className; + this.anonymous = anonymous; + this.propertyClassNames = propertyClassNames; + } + + public boolean isAnonymous() { + return anonymous; + } + + public String getClassName() { + return className; + } + + public List getPropertyClassNames() { + return propertyClassNames; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java new file mode 100644 index 0000000000..94f8d88646 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java @@ -0,0 +1,357 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sdo.helper.XSDHelperImpl; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.codegen.ecore.genmodel.GenClass; +import org.eclipse.emf.codegen.ecore.genmodel.GenModel; +import org.eclipse.emf.codegen.ecore.genmodel.GenModelFactory; +import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; +import org.eclipse.emf.codegen.util.CodeGenUtil; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.BasicExtendedMetaData; +import org.eclipse.emf.ecore.util.ExtendedMetaData; + +import commonj.sdo.helper.XSDHelper; + +public class WSDL2JavaGenerator { + static protected final int DYNAMIC_SDO = 1; + + /** + * Generate Java interfaces from WSDL Usage arguments: [ -targetDirectory + * ] [ -javaPackage ] + * For example: generate somedir/somefile.wsdl Basic options: + * -targetDirectory Generates the Java source code in the specified + * directory. By default, the code is generated in the same directory as the + * input wsdl file. -javaPackage Overrides the Java package for the + * generated classes. By default the package name is derived from the + * targetNamespace of the WSDL definition being generated. For example, if + * the targetNamespace is "http://www.example.com/simple", the default + * package will be "com.example.simple". + */ + public static void main(String args[]) { + if (args.length == 0) { + printUsage(); + return; + } + + String portName = null; + String targetDirectory = null; + String wsdlJavaPackage = null; + String xsdJavaPackage = null; + int dynamicSDO = 0; + + int index = 0; + for (; index < args.length && args[index].startsWith("-"); ++index) { + if (args[index].equalsIgnoreCase("-port")) { + portName = args[++index]; + } else if (args[index].equalsIgnoreCase("-targetDirectory")) { + targetDirectory = args[++index]; + } else if (args[index].equalsIgnoreCase("-javaPackage")) { + wsdlJavaPackage = args[++index]; + } else if (args[index].equalsIgnoreCase("-dynamicSDO")) { + dynamicSDO = DYNAMIC_SDO; + } + // else if (...) + else { + printUsage(); + return; + } + } + + String wsdlFileName = args[index]; + if (wsdlFileName == null || targetDirectory == null) { + printUsage(); + return; + } + + generateFromWSDL(wsdlFileName, portName!=null? new String[]{portName}:null, targetDirectory, wsdlJavaPackage, xsdJavaPackage, dynamicSDO); + + } + + @SuppressWarnings("unchecked") + public static void generateFromWSDL(String wsdlFileName, String targetDirectory, + String wsdlJavaPackage, + String xsdJavaPackage, int genOptions){ + generateFromWSDL( wsdlFileName, null, targetDirectory, + wsdlJavaPackage, + xsdJavaPackage, genOptions); + + } + + + @SuppressWarnings("unchecked") + public static void generateFromWSDL(String wsdlFileName, String[] ports, + String targetDirectory, String wsdlJavaPackage, + String xsdJavaPackage, int genOptions) + { + + // Initialize the SDO runtime + DataObjectUtil.initRuntime(); + EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry); + XSDHelper xsdHelper = new XSDHelperImpl(extendedMetaData, null); + + try { + + // Load the WSDL file + File inputFile = new File(wsdlFileName).getAbsoluteFile(); + InputStream inputStream = new FileInputStream(inputFile); + + // Define SDO metadata + xsdHelper.define(inputStream, inputFile.toURI().toString()); + + if (targetDirectory == null) { + targetDirectory = new File(wsdlFileName).getCanonicalFile().getParent(); + } else { + targetDirectory = new File(targetDirectory).getCanonicalPath(); + } + + // Populate the typeMapping table that will be given to the Axis2 WSDL2Java + Map typeMapping = + new HashMap(); + if (!packageRegistry.values().isEmpty()) { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + + // Populate list of GenPackages and a map of GenClasses keyed by EClass + List genPackages = new ArrayList(); + Map genClasses = new HashMap(); + for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) { + EPackage currentEPackage = (EPackage)iter.next(); + String currentBasePackage = extractBasePackageName(currentEPackage, xsdJavaPackage); + String currentPrefix = CodeGenUtil.capName(currentEPackage.getName()); + + GenPackage currentGenPackage = createGenPackage(currentEPackage, currentBasePackage, + currentPrefix, genOptions, resourceSet); + genPackages.add(currentGenPackage); + for (GenClass genClass : (List)currentGenPackage.getGenClasses()) { + genClasses.put(genClass.getEcoreClass(), genClass); + } + + } + + // Process all the SDO packages + // Populate the qname -> interfaceName typeMapping table + for (GenPackage currentGenPackage : genPackages) { + EPackage currentEPackage = currentGenPackage.getEcorePackage(); + + // Populate the type mappings for all the complex types + for (GenClass genClass : (List)currentGenPackage.getGenClasses()) { + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(genClass.getEcoreClass())); + String interfaceName = (DYNAMIC_SDO & genOptions) == DYNAMIC_SDO ? "commonj.sdo.DataObject" : currentGenPackage + .getInterfacePackageName() + + '.' + genClass.getInterfaceName(); + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(interfaceName, false, null); + typeMapping.put(qname, typeMappingEntry); + } + + // Process all the global XSD elements + EClass documentRoot = extendedMetaData.getDocumentRoot(currentEPackage); + if (documentRoot != null) { + for (EStructuralFeature element : (List)extendedMetaData + .getElements(documentRoot)) { + EClassifier elementType = element.getEType(); + + // Handle a complex type + if (elementType instanceof EClass) { + EClass eClass = (EClass)elementType; + + GenClass genClass = genClasses.get(elementType); + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(element)); + String interfaceName = (DYNAMIC_SDO & genOptions) == DYNAMIC_SDO ? "commonj.sdo.DataObject" : genClass + .getGenPackage().getInterfacePackageName() + + '.' + genClass.getInterfaceName(); + boolean anonymous = extendedMetaData.isAnonymous(eClass); + + // Build list of property class names + List propertyClassNames=new ArrayList(); + for (EStructuralFeature feature : (List)eClass.getEStructuralFeatures()) { + EClassifier propertyType = feature.getEType(); + if (propertyType instanceof EClass) { + GenClass propertyGenClass = genClasses.get(propertyType); + String propertyClassName = (DYNAMIC_SDO & genOptions) == DYNAMIC_SDO ? "commonj.sdo.DataObject" + : propertyGenClass.getGenPackage().getInterfacePackageName() + '.' + + propertyGenClass.getInterfaceName(); + propertyClassNames.add(propertyClassName); + } else if (propertyType instanceof EClassifier) { + String propertyClassName = propertyType.getInstanceClass().getName(); + propertyClassNames.add(propertyClassName); + } + } + + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(interfaceName, anonymous, propertyClassNames); + typeMapping.put(qname, typeMappingEntry); + + } else { + + // Handle a simple type + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(element)); + String className = elementType.getInstanceClass().getName(); + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(className, false, null); + typeMapping.put(qname, typeMappingEntry); + } + } + } + } + } + + try { + JavaInterfaceGenerator codeGenerator = new JavaInterfaceGenerator(wsdlFileName, + ports, + targetDirectory, + wsdlJavaPackage, + typeMapping); + codeGenerator.generate(); + } catch (Exception e) { + throw new IllegalArgumentException(e); + } + + } catch (IOException e) { + throw new IllegalArgumentException(e); + } + } + + @SuppressWarnings("unchecked") + public static GenPackage createGenPackage(EPackage ePackage, String basePackage, String prefix, + int genOptions, ResourceSet resourceSet) { + GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions); + + URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore"); + URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel"); + + Resource ecoreResource = resourceSet.createResource(ecoreURI); + ecoreResource.getContents().add(ePackage); + + Resource genModelResource = resourceSet.createResource(genModelURI); + genModelResource.getContents().add(genModel); + + return (GenPackage)genModel.getGenPackages().get(0); + } + + public static GenModel ecore2GenModel(EPackage ePackage, String basePackage, + String prefix, int genOptions) { + GenModel genModel = GenModelFactory.eINSTANCE.createGenModel(); + genModel.initialize(Collections.singleton(ePackage)); + + genModel.setRootExtendsInterface(""); + genModel.setRootImplementsInterface("commonj.sdo.DataObject"); + genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.DataObjectImpl"); + genModel.setFeatureMapWrapperInterface("commonj.sdo.Sequence"); + genModel.setFeatureMapWrapperInternalInterface("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setFeatureMapWrapperClass("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setSuppressEMFTypes(true); + genModel.setSuppressEMFMetaData(true); + genModel.setSuppressEMFModelTags(true); + genModel.setCanGenerate(true); + // FIXME workaround java.lang.NoClassDefFoundError: + // org/eclipse/jdt/core/jdom/IDOMNode with 02162006 build + genModel.setFacadeHelperClass("Hack"); + genModel.setForceOverwrite(true); + + GenPackage genPackage = (GenPackage)genModel.getGenPackages().get(0); + + if (basePackage != null) { + genPackage.setBasePackage(basePackage); + } + if (prefix != null) { + genPackage.setPrefix(prefix); + } + + return genModel; + } + + public static String extractBasePackageName(EPackage ePackage, String javaPackage) { + String qualifiedName = javaPackage != null ? javaPackage : ePackage.getName(); + String name = /* CodeGenUtil. */shortName(qualifiedName); + String baseName = qualifiedName.substring(0, qualifiedName.length() - name.length()); + if (javaPackage != null || !name.equals(qualifiedName)) { + ePackage.setName(name); + } + return baseName != null ? /* CodeGenUtil. */safeQualifiedName(baseName) : null; + } + + public static String shortName(String qualifiedName) { + int index = qualifiedName.lastIndexOf("."); + return index != -1 ? qualifiedName.substring(index + 1) : qualifiedName; + } + + public static String safeQualifiedName(String qualifiedName) { + StringBuffer safeQualifiedName = new StringBuffer(); + for (StringTokenizer stringTokenizer = new StringTokenizer(qualifiedName, "."); + stringTokenizer.hasMoreTokens();) { + String name = stringTokenizer.nextToken(); + safeQualifiedName.append(CodeGenUtil.safeName(name)); + if (stringTokenizer.hasMoreTokens()) { + safeQualifiedName.append('.'); + } + } + return safeQualifiedName.toString(); + } + + protected static void printDiagnostic(Diagnostic diagnostic, String indent) { + System.out.print(indent); + System.out.println(diagnostic.getMessage()); + for (Iterator i = diagnostic.getChildren().iterator(); i.hasNext();) { + printDiagnostic((Diagnostic)i.next(), indent + " "); + } + } + + protected static void printUsage() { + System.out.println("Usage arguments:"); + System.out.println(" [ -targetDirectory ]"); + System.out.println(" [ -javaPackage ]"); + System.out.println(" [ -dynamicSDO ]"); + System.out.println(" "); + System.out.println(""); + System.out.println("For example:"); + System.out.println(""); + System.out.println(" generate somedir/somefile.wsdl"); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl new file mode 100644 index 0000000000..e3da5da20f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + /** + * .java + * + * This file was auto-generated from WSDL + * by the Apache Axis2 version: #axisVersion# #today# + */ + package ; + + import org.osoa.sca.annotations.Remotable; + import org.apache.tuscany.api.annotation.DataType; + + /* + * java interface + */ + + @Remotable + @DataType(name="commonj.sdo.DataObject") + public interface { + + + + + + + + /** + * Auto generated method signatures + * @param + */ + public void + ( + + , + ) throws java.rmi.RemoteException; + + + + + + /** + * Auto generated method signature + * @param + */ + + public void start( + + + , + ,final . callback) throws java.rmi.RemoteException; + + + + + + + + + /** + * Auto generated method signature + + *@param + + */ + public void + ( + + , + + ) throws java.rmi.RemoteException; + + + + + + // + } + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java new file mode 100644 index 0000000000..e679496509 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer; + +public class CustomerValue { + + public int getValue(String custId, String stockSymbol) { + return 0; + } + + public Customer getCustomerDetails(String custId) { + return new Customer(); + } + + public String noArgsServiceMethod() + { + return new String(); + } + + private void privateServiceMethod() + { + + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java new file mode 100644 index 0000000000..4b5a795f2c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import org.apache.tuscany.tools.java2wsdl.generate.account.Account; +import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer; + +public class CustomerWithAccount { + + private Customer customer = new Customer(); + + private Account[] accounts; + + public int getValue(String custId, String stockSymbol) { + return 123; + } + + public Customer getCustomerDetails(String custId) { + return customer; + } + + public Account getCustomerAccount(String custId, String accountId) { + return accounts[0]; + } + + public Account[] getAccounts() { + return accounts; + } + + public void setAccounts(Account[] accounts) { + this.accounts = accounts; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java new file mode 100644 index 0000000000..a72321c9b1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.File; + +import junit.framework.TestCase; + +/** + * A JUnit test case to test the Tuscany Java 2 WSDL Generation + */ +public class TuscanyJava2WSDLTestCase extends TestCase { + + /** + * setup the pre-requisites for the test case to run + * + * @exception Exception + */ + protected void setUp() throws Exception { + // System.out.println("inside setup"); + super.setUp(); + } + + /** + * @exception Exception + */ + protected void tearDown() throws Exception { + // System.out.println("inside tearDown"); + super.tearDown(); + } + + + /** + * Simple WSDL generation test. + */ + public void testSimpleWSDLGeneration() { + String[] arguments = new String[] { "-cn","org.apache.tuscany.tools.java2wsdl.generate.CustomerValue", + "-o", "target/java2wsdl-source", + "-xc", "org.apache.tuscany.tools.java2wsdl.generate.extra.GoldCustomer"}; + + + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CustomerValue.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + /** + * Test WSDL generation where a parameter Object[] is involved. + */ + public void testWsdlGeneration2() { + + String[] arguments = new String[] + { + "-cn", + "org.apache.tuscany.tools.java2wsdl.generate.CustomerWithAccount", + "-o", "target/java2wsdl-source", }; + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CustomerWithAccount.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + public void testWsdlGeneration_SDO_Static() + { + //tests for SDOs where XSD exist. Hence no XSDs must be generated + String[] arguments = new String[] { + "-cn", + "org.soapinterop.CreditScoreDocLit", + "-o", "target/java2wsdl-source", + "-ixsd", "[http://www.example.org/creditscore/doclit/," + + "http://www.example.org/creditscore/doclit/xsd]"}; + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CreditScoreDocLit.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + + + /** + * Test WSDL generation from a java interface and then generate the java + * interface using the generated WSDL. + */ + public void _testRoundTrip() { + // TODO implement round trip + // this should re-generate java interfaces from the generated wsdl + // and compile (?) the generated java code. + // fail(); + + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java new file mode 100644 index 0000000000..84d59164ee --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate.account; + +import java.math.BigDecimal; + +public class Account { + int accountType; + + String accountNo; + + BigDecimal balance; + + public String getAccountNo() { + return accountNo; + } + + public void setAccountNo(String accountNo) { + this.accountNo = accountNo; + } + + public int getAccountType() { + return accountType; + } + + public void setAccountType(int accountType) { + this.accountType = accountType; + } + + public BigDecimal getBalance() { + return balance; + } + + public void setBalance(BigDecimal balance) { + this.balance = balance; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java new file mode 100644 index 0000000000..a28399e7fe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate.customer; + +public class Customer { + private String name = ""; + + public int custType = 0; + + public String getName() { + return name; + } +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java new file mode 100644 index 0000000000..afc68a3217 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate.extra; + +import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer; + + + + +public class GoldCustomer extends Customer { + public String goldCustNumber = ""; + + public String getGoldCustNumber() { + return goldCustNumber; + } + + public void setGoldCustNumber(String goldCustNumber) { + this.goldCustNumber = goldCustNumber; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java new file mode 100644 index 0000000000..e2a2d332c5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.io.IOException; +import java.io.FileReader; +import java.io.Reader; + +import junit.framework.TestCase; + +/** + * Test case for WSDL2Java + */ +public class WSDL2JavaGeneratorTestCase extends TestCase { + + public void testAccountService() { + + String basedir = System.getProperty("basedir"); + if (basedir == null) + basedir ="."; + + + String[] args=new String[] { "-targetDirectory", basedir + "/target/wsdl2java-source", + "-javaPackage", "org.apache.tuscany.tools.wsdl2java.generate.account", + basedir + "/src/test/resources/AccountService.wsdl"}; + + WSDL2JavaGenerator.main(args); + + } + + public void testDynamicSDO() throws IOException { + String basedir = System.getProperty("basedir"); + if (basedir == null) + basedir ="."; + + String[] args=new String[] { "-targetDirectory", basedir + "/target/wsdl2java-source", + "-javaPackage", "org.apache.tuscany.tools.wsdl2java.generate.account", + "-dynamicSDO", + basedir + "/src/test/resources/AccountService.wsdl"}; + + WSDL2JavaGenerator.main(args); + + char buffer[] = new char[1024]; + Reader file = new FileReader("target/wsdl2java-source/org/apache/tuscany/tools/wsdl2java/generate/account/AccountService.java"); + file.read(buffer); + file.close(); + assertTrue(new String(buffer).indexOf("commonj.sdo.DataObject") != -1); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java new file mode 100644 index 0000000000..e9e8aa882a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.soapinterop; + +public interface CreditScoreDocLit { + public org.example.creditscore.doclit.CreditReport getCreditScore( + org.example.creditscore.doclit.Customer param0) throws java.rmi.RemoteException; + } + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/AccountService.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/AccountService.wsdl new file mode 100644 index 0000000000..e7be3ce5ba --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/AccountService.wsdl @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl new file mode 100644 index 0000000000..09d1a58589 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/helloworld.wsdl new file mode 100644 index 0000000000..051f604bb2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/helloworld.wsdl @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/interopdoc.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/interopdoc.wsdl new file mode 100644 index 0000000000..820c26ca34 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/interopdoc.wsdl @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/sequences.xsd b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/sequences.xsd new file mode 100644 index 0000000000..a565f3fa65 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/sequences.xsd @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/LICENSE.txt new file mode 100644 index 0000000000..5f6ab3e05c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, serviceDefinition marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/NOTICE.txt new file mode 100644 index 0000000000..ecc68a9614 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/pom.xml new file mode 100644 index 0000000000..623d04348e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/pom.xml @@ -0,0 +1,91 @@ + + + + + + org.apache.tuscany.sca.extensions.jms + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-jms + Apache Tuscany Binding for JMS + Implementation of the SCA JMS Binding + + + + + geronimo-spec + geronimo-spec-jms + + + + activemq + activemq-core + + + + geronimo-spec + geronimo-spec-j2ee-management + + + + org.apache.tuscany.sca.kernel + tuscany-spi + + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${extensionVersion} + compile + + + + + org.easymock + easymock + + + + junit + junit + 4.2 + test + + + + xmlunit + xmlunit + 1.0 + test + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/DefaultOperationAndDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/DefaultOperationAndDataBinding.java new file mode 100644 index 0000000000..c96bb76b1b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/DefaultOperationAndDataBinding.java @@ -0,0 +1,162 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import java.io.Serializable; +import java.io.StringReader; + +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.ObjectMessage; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; + +public class DefaultOperationAndDataBinding implements OperationAndDataBinding { + + protected String operationPropertyName; + + private boolean xmlFormat; + + public DefaultOperationAndDataBinding(JMSBindingDefinition jmsBinding) { + this.operationPropertyName = jmsBinding.getOperationSelectorPropertyName(); + this.xmlFormat = jmsBinding.isXMLFormat(); + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#getOperationName(javax.jms.Message) + */ + public String getOperationName(Message message) { + try { + + return message.getStringProperty(operationPropertyName); + + } catch (JMSException e) { + throw new JMSBindingException("Exception retreiving operation name from message", e); + } + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#setOperationName(javax.jms.Message, + * java.lang.String) + */ + public void setOperationName(String operationName, Message message) { + try { + + message.setStringProperty(operationPropertyName, operationName); + + } catch (JMSException e) { + throw new JMSBindingException("Exception setting the operation name on message", e); + } + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#extractPayload(javax.jms.Session, + * java.lang.Object) + */ + public Message createJMSMessage(Session session, Object o) { + if (xmlFormat) { + return createXMLJMSMessage(session, o); + } else { + return createObjectJMSMessage(session, o); + } + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#extractPayload(javax.jms.Message) + */ + public Object extractPayload(Message msg) { + if (xmlFormat) { + return extractXMLPayload(msg); + } else { + return extractObjectPayload(msg); + } + } + + protected Object extractXMLPayload(Message msg) { + try { + + String xml = ((TextMessage)msg).getText(); + + XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml)); + StAXOMBuilder builder = new StAXOMBuilder(reader); + OMElement omElement = builder.getDocumentElement(); + + return new Object[] {omElement}; + + } catch (XMLStreamException e) { + throw new JMSBindingException(e); + } catch (JMSException e) { + throw new JMSBindingException(e); + } + } + + protected Message createXMLJMSMessage(Session session, Object o) { + try { + + TextMessage message = session.createTextMessage(); + + if (o instanceof OMElement) { + message.setText(o.toString()); + } else { + message.setText(((Object[])o)[0].toString()); + } + + return message; + + } catch (JMSException e) { + throw new JMSBindingException(e); + } + } + + protected Object extractObjectPayload(Message msg) { + try { + + return ((ObjectMessage)msg).getObject(); + + } catch (JMSException e) { + throw new JMSBindingException(e); + } + } + + protected Message createObjectJMSMessage(Session session, Object o) { + try { + + ObjectMessage message = session.createObjectMessage(); // default + message.setObject((Serializable)o); + return message; + + } catch (JMSException e) { + throw new JMSBindingException(e); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java new file mode 100644 index 0000000000..c0bf6ea225 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java @@ -0,0 +1,177 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jms; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import javax.jms.Destination; +import javax.naming.NamingException; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.ServiceBinding; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.BindingBuilderExtension; +import org.apache.tuscany.spi.model.AbstractReferenceDefinition; +import org.apache.tuscany.spi.model.ServiceDefinition; +import org.apache.tuscany.spi.model.ServiceContract; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.idl.wsdl.WSDLServiceContract; + +/** + * Builds a Service or Reference for JMS binding. + * + * @version $Rev: 449970 $ $Date: 2006-09-26 06:05:35 -0400 (Tue, 26 Sep 2006) $ + */ + +public class JMSBindingBuilder extends BindingBuilderExtension { + + private static final String DEFAULT_JMS_RESOURCE_FACTORY = + "org.apache.tuscany.binding.jms.SimpleJMSResourceFactory"; + + private static final String OM_DATA_BINDING = OMElement.class.getName(); + + protected Class getBindingType() { + return JMSBindingDefinition.class; + } + + public ServiceBinding build(CompositeComponent parent, + ServiceDefinition serviceDefinition, + JMSBindingDefinition jmsBinding, + DeploymentContext deploymentContext) { + + Class interfaze = serviceDefinition.getServiceContract().getInterfaceClass(); + + ServiceContract serviceContract = serviceDefinition.getServiceContract(); + jmsBinding.setXMLFormat(serviceContract instanceof WSDLServiceContract); + + JMSResourceFactory jmsResourceFactory = getJMSResourceFactory(jmsBinding); + + if (serviceContract instanceof WSDLServiceContract) { + serviceContract.setDataBinding(OM_DATA_BINDING); + } + + OperationAndDataBinding requestODB = + getRequestOperationAndDatabinding(jmsBinding, deploymentContext.getClassLoader()); + OperationAndDataBinding responseODB = + getRequestOperationAndDatabinding(jmsBinding, deploymentContext.getClassLoader()); + + return new JMSServiceBinding(serviceDefinition.getName(), parent, jmsBinding, jmsResourceFactory, + serviceContract, requestODB, responseODB, interfaze); + } + + public JMSReferenceBinding build(CompositeComponent parent, + AbstractReferenceDefinition referenceDefinition, + JMSBindingDefinition jmsBinding, + DeploymentContext deploymentContext) { + + String name = referenceDefinition.getName(); + ServiceContract serviceContract; + try { + serviceContract = (ServiceContract) referenceDefinition.getServiceContract().clone(); + } catch (CloneNotSupportedException e) { + throw new JMSBindingException("Couldn't clone the Service Contract", e); + } + serviceContract.setDataBinding(OM_DATA_BINDING); + + JMSResourceFactory jmsResourceFactory = getJMSResourceFactory(jmsBinding); + + Destination requestDest; + Destination replyDest = null; + try { + requestDest = jmsResourceFactory.lookupDestination(jmsBinding.getDestinationName()); + if (jmsBinding.getResponseDestinationName() != null) { + replyDest = jmsResourceFactory.lookupDestination(jmsBinding.getResponseDestinationName()); + } + } catch (NamingException e) { + throw new JMSBindingException(e); + } + + OperationAndDataBinding requestODB = + getRequestOperationAndDatabinding(jmsBinding, deploymentContext.getClassLoader()); + OperationAndDataBinding responseODB = + getRequestOperationAndDatabinding(jmsBinding, deploymentContext.getClassLoader()); + + return new JMSReferenceBinding(name, parent, jmsBinding, jmsResourceFactory, serviceContract, requestODB, responseODB, + requestDest, replyDest); + + } + + private JMSResourceFactory getJMSResourceFactory(JMSBindingDefinition jmsBinding) { + String className = jmsBinding.getJmsResourceFactoryName(); + if (className != null && !className.equals("")) { + try { + Class factoryClass = Class.forName(className != null ? className : DEFAULT_JMS_RESOURCE_FACTORY); + Constructor constructor = factoryClass.getDeclaredConstructor(new Class[]{JMSBindingDefinition.class}); + return (JMSResourceFactory) constructor.newInstance(jmsBinding); + } catch (ClassNotFoundException e) { + throw new JMSBindingException("Error loading the JMSResourceFactory", e); + } catch (SecurityException e) { + throw new JMSBindingException("Error loading the JMSResourceFactory", e); + } catch (NoSuchMethodException e) { + throw new JMSBindingException("Error loading the JMSResourceFactory", e); + } catch (IllegalArgumentException e) { + throw new JMSBindingException("Error loading the JMSResourceFactory", e); + } catch (InstantiationException e) { + throw new JMSBindingException("Error loading the JMSResourceFactory", e); + } catch (IllegalAccessException e) { + throw new JMSBindingException("Error loading the JMSResourceFactory", e); + } catch (InvocationTargetException e) { + throw new JMSBindingException("Error loading the JMSResourceFactory", e); + } + } else { + return new SimpleJMSResourceFactory(jmsBinding); + } + + } + + protected OperationAndDataBinding getRequestOperationAndDatabinding(JMSBindingDefinition jmsBinding, + ClassLoader cl) { + String className = jmsBinding.getRequestOperationAndDatabindingName(); + OperationAndDataBinding operationAndDataBinding = instantiateClass(jmsBinding, cl, className); + return operationAndDataBinding; + } + + protected OperationAndDataBinding getResponseOperationAndDatabinding(JMSBindingDefinition jmsBinding, + ClassLoader cl) { + String className = jmsBinding.getResponseOperationAndDatabindingName(); + OperationAndDataBinding operationAndDataBinding = instantiateClass(jmsBinding, cl, className); + return operationAndDataBinding; + } + + protected OperationAndDataBinding instantiateClass(JMSBindingDefinition jmsBinding, ClassLoader cl, + String className) { + OperationAndDataBinding operationAndDataBinding; + if (cl == null) { + cl = this.getClass().getClassLoader(); + } + try { + Class clazz; + try { + clazz = cl.loadClass(className); + } catch (ClassNotFoundException e) { + clazz = this.getClass().getClassLoader().loadClass(className); + } + Constructor constructor = clazz.getDeclaredConstructor(new Class[]{JMSBindingDefinition.class}); + operationAndDataBinding = (OperationAndDataBinding) constructor.newInstance(jmsBinding); + + } catch (Throwable e) { + throw new JMSBindingException("Exception instantiating OperationAndDataBinding class", e); + } + return operationAndDataBinding; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java new file mode 100644 index 0000000000..c1ad28c272 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java @@ -0,0 +1,274 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import javax.jms.DeliveryMode; + +import org.apache.tuscany.spi.model.BindingDefinition; + +/** + * Represents a binding to a JMS resource. + */ + +public class JMSBindingDefinition extends BindingDefinition { + + public final static int DESTINATION_TYPE_QUEUE = 0; + public final static int DESTINATION_TYPE_TOPIC = 1; + + private int destinationType = DESTINATION_TYPE_QUEUE; + + private String destinationName; + + // Topic or Query factory name + private String connectionFactoryName; + + private String activationSpecName; + + private String initialContextFactoryName; // "org.apache.activemq.jndi.ActiveMQInitialContextFactory" + + private String jNDIProviderURL; // "tcp://hostname:61616" + + // Maps to javax.jms.DeliveryMode + private int deliveryMode = DeliveryMode.NON_PERSISTENT; + + private int timeToLive = 1000; // in mili seconds + + private int priority; + + private String replyTo; + + private String jmsResourceFactoryName; + + private String operationSelectorName; + + private String operationSelectorPropertyName = DEFAULT_OPERATION_PROP_NAME; + + private String correlationScheme; + private String responseDestinationName; + + private String requestOperationAndDatabindingName = DEFAULT_ODB_CLASSNAME; + private String responseOperationAndDatabindingName = DEFAULT_ODB_CLASSNAME; + + private boolean xmlFormat; + + public static final String DEFAULT_ODB_CLASSNAME = DefaultOperationAndDataBinding.class.getName(); + public static final String DEFAULT_OPERATION_PROP_NAME = "scaOperationName"; + + public JMSBindingDefinition(int destinationType, + String destinationName, + String connectionFactoryName, + String activationSpecName, + String initialContextFactoryName, + String providerURL, + int deliveryMode, + int timeToLive, + int priority, + String replyTo) { + super(); + this.destinationType = destinationType; + this.destinationName = destinationName; + this.connectionFactoryName = connectionFactoryName; + this.activationSpecName = activationSpecName; + this.initialContextFactoryName = initialContextFactoryName; + this.jNDIProviderURL = providerURL; + this.deliveryMode = deliveryMode; + this.timeToLive = timeToLive; + this.priority = priority; + this.replyTo = replyTo; + } + + public JMSBindingDefinition() { + super(); + } + + public String getActivationSpecName() { + return activationSpecName; + } + + public void setActivationSpecName(String activationSpecName) { + this.activationSpecName = activationSpecName; + } + + public String getConnectionFactoryName() { + return connectionFactoryName; + } + + public void setConnectionFactoryName(String connectionFactoryName) { + this.connectionFactoryName = connectionFactoryName; + } + + public int getDeliveryMode() { + return deliveryMode; + } + + public void setDeliveryMode(int deliveryMode) { + this.deliveryMode = deliveryMode; + } + + public String getDestinationName() { + return destinationName; + } + + public void setDestinationName(String destinationName) { + this.destinationName = destinationName; + } + + public String getInitialContextFactoryName() { + return initialContextFactoryName; + } + + public void setInitialContextFactoryName(String initialContextFactoryName) { + this.initialContextFactoryName = initialContextFactoryName; + } + + public String getJNDIProviderURL() { + return jNDIProviderURL; + } + + public void setJNDIProviderURL(String providerURL) { + jNDIProviderURL = providerURL; + } + + public int getPriority() { + return priority; + } + + public void setPriority(int priority) { + this.priority = priority; + } + + public String getReplyTo() { + return replyTo; + } + + public void setReplyTo(String replyTo) { + this.replyTo = replyTo; + } + + public int getTimeToLive() { + return timeToLive; + } + + public void setTimeToLive(int timeToLive) { + this.timeToLive = timeToLive; + } + + public int getDestinationType() { + return destinationType; + } + + public void setDestinationType(int destinationType) { + this.destinationType = destinationType; + } + + public String getJmsResourceFactoryName() { + return jmsResourceFactoryName; + } + + public void setJmsResourceFactoryName(String jmsResourceFactoryName) { + this.jmsResourceFactoryName = jmsResourceFactoryName; + } + + public String getOperationSelectorName() { + return operationSelectorName; + } + + public void setOperationSelectorName(String operationSelectorName) { + this.operationSelectorName = operationSelectorName; + } + + public String getOperationSelectorPropertyName() { + return operationSelectorPropertyName; + } + + public void setOperationSelectorPropertyName(String operationSelectorPropertyName) { + this.operationSelectorPropertyName = operationSelectorPropertyName; + } + + public void setCorrelationScheme(String correlationScheme) { + this.correlationScheme = correlationScheme; + } + + public String getCorrelationScheme() { + return correlationScheme; + } + + public void setCreateDestination(String create) { + } + + public void setResponseDestinationName(String name) { + this.responseDestinationName = name; + } + + public String getResponseDestinationName() { + return responseDestinationName; + } + + public void setResponseDestinationType(int destination_type_queue2) { + // TODO Auto-generated method stub + + } + + public void setCreateResponseDestination(String create) { + // TODO Auto-generated method stub + + } + + public void setRequestOperationAndDatabindingName(String name) { + this.requestOperationAndDatabindingName = name; + } + + public String getRequestOperationAndDatabindingName() { + return requestOperationAndDatabindingName; + } + + public void setResponseOperationAndDatabindingName(String name) { + this.responseOperationAndDatabindingName = name; + } + + public String getResponseOperationAndDatabindingName() { + return responseOperationAndDatabindingName; + } + + public boolean isXMLFormat() { + return xmlFormat; + } + + public void setXMLFormat(boolean b) { + this.xmlFormat = b; + } + + public Object clone() { + + JMSBindingDefinition clone = new JMSBindingDefinition(); + clone.destinationType = this.destinationType; + clone.destinationType = this.destinationType; + clone.connectionFactoryName = this.connectionFactoryName; + clone.activationSpecName = this.activationSpecName; + clone.initialContextFactoryName = this.initialContextFactoryName; + clone.jNDIProviderURL = this.jNDIProviderURL; + clone.deliveryMode = this.deliveryMode; + clone.timeToLive = this.timeToLive; + clone.priority = this.priority; + clone.replyTo = this.replyTo; + + return clone(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingException.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingException.java new file mode 100644 index 0000000000..a197eeffc6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingException.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jms; + +import org.apache.tuscany.api.TuscanyRuntimeException; + +public class JMSBindingException extends TuscanyRuntimeException { + private static final long serialVersionUID = 1L; + + public JMSBindingException() { + super(); + } + + public JMSBindingException(String arg0, Throwable arg1) { + super(arg0, arg1); + } + + public JMSBindingException(String arg0) { + super(arg0); + } + + public JMSBindingException(Throwable arg0) { + super(arg0); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java new file mode 100644 index 0000000000..5ffa8695ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java @@ -0,0 +1,199 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jms; + +import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; +import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; +import static org.osoa.sca.Constants.SCA_NS; + +import java.util.Arrays; +import java.util.List; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.model.ModelObject; +import org.osoa.sca.annotations.Scope; + +/** + * Loader for handling elements based on the 0.96 draft 1 spec. + */ +@Scope("COMPOSITE") +public class JMSBindingLoader extends LoaderExtension { + + public static final QName BINDING_JMS = + new QName(SCA_NS, "binding.jms"); + + public static final List VALID_CORRELATION_SCHEMES = + Arrays.asList(new String[] {"requestmsgidtocorrelid", "requestcorrelidtocorrelid", "none"}); + + public JMSBindingLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + public QName getXMLType() { + return BINDING_JMS; + } + + public JMSBindingDefinition load(CompositeComponent parent, + ModelObject modelObject, + XMLStreamReader reader, + DeploymentContext deploymentContext) throws XMLStreamException, LoaderException { + + JMSBindingDefinition jmsBinding = new JMSBindingDefinition(); + + String uri = reader.getAttributeValue(null, "uri"); + if (uri != null && uri.length() > 0) { + parseURI(jmsBinding, uri); + } + + String correlationScheme = reader.getAttributeValue(null, "correlationScheme"); + if (correlationScheme != null && correlationScheme.length() > 0) { + if (VALID_CORRELATION_SCHEMES.contains(correlationScheme.toLowerCase())) { + jmsBinding.setCorrelationScheme(correlationScheme); + } else { + throw new LoaderException("invalid correlationScheme: " + correlationScheme); + } + } + + String initialContextFactory = reader.getAttributeValue(null, "initialContextFactory"); + if (initialContextFactory != null && initialContextFactory.length() > 0) { + jmsBinding.setInitialContextFactoryName(initialContextFactory); + } + + String jndiProviderURL = reader.getAttributeValue(null, "JNDIProviderURL"); + if (jndiProviderURL != null && jndiProviderURL.length() > 0) { + jmsBinding.setJNDIProviderURL(jndiProviderURL); + } + + while (true) { + switch (reader.next()) { + case START_ELEMENT: + String elementName = reader.getName().getLocalPart(); + if ("destination".equals(elementName)) { + parseDestination(reader, jmsBinding); + } else if ("connectionFactory".equals(elementName)) { + parseConnectionFactory(reader, jmsBinding); + } else if ("activationSpec".equals(elementName)) { + parseActivationSpec(reader, jmsBinding); + } else if ("response".equals(elementName)) { + parseResponse(reader, jmsBinding); + } else if ("headers".equals(elementName)) { + parseHeaders(reader, jmsBinding); + } else if ("operationAndDataBinding".equals(elementName)) { + parseOperationAndDataBinding(reader, jmsBinding); + } else if ("operation".equals(elementName)) { + parseOperation(reader, jmsBinding); + } else if ("resourceAdapter".equals(elementName)) { + parseResourceAdapter(reader, jmsBinding); + } + reader.next(); + break; + + case END_ELEMENT: + QName x = reader.getName(); + if (x.equals(BINDING_JMS)) { + return jmsBinding; + } + throw new RuntimeException("Incomplete binding.jms definition"); + } + } + } + + protected void parseActivationSpec(XMLStreamReader reader, JMSBindingDefinition jmsBinding) { + String name = reader.getAttributeValue(null, "name"); + if (name != null && name.length() > 0) { + jmsBinding.setActivationSpecName(name); + } else { + throw new RuntimeException("missing ActivationSpec name"); + } + } + + protected void parseConnectionFactory(XMLStreamReader reader, JMSBindingDefinition jmsBinding) { + String name = reader.getAttributeValue(null, "name"); + if (name != null && name.length() > 0) { + jmsBinding.setConnectionFactoryName(name); + } else { + throw new RuntimeException("missing connectionFactory name"); + } + } + + protected void parseResponse(XMLStreamReader reader, JMSBindingDefinition jmsBinding) { + // TODO Auto-generated method stub + + } + + protected void parseResourceAdapter(XMLStreamReader reader, JMSBindingDefinition jmsBinding) throws XMLStreamException { + // TODO Auto-generated method stub + } + + protected void parseOperation(XMLStreamReader reader, JMSBindingDefinition jmsBinding) throws XMLStreamException { + // TODO Auto-generated method stub + } + + protected void parseOperationAndDataBinding(XMLStreamReader reader, JMSBindingDefinition jmsBinding) + throws XMLStreamException { + String name = reader.getAttributeValue(null, "name"); + String use = reader.getAttributeValue(null, "use"); + if (name != null && name.length() > 0) { + if ("request".equalsIgnoreCase(use)) { + jmsBinding.setRequestOperationAndDatabindingName(name); + } else if ("response".equalsIgnoreCase(use)) { + jmsBinding.setResponseOperationAndDatabindingName(name); + } else { + jmsBinding.setRequestOperationAndDatabindingName(name); + jmsBinding.setResponseOperationAndDatabindingName(name); + } + } + } + + protected void parseHeaders(XMLStreamReader reader, JMSBindingDefinition jmsBinding) throws XMLStreamException { + // TODO Auto-generated method stub + } + + protected void parseDestination(XMLStreamReader reader, JMSBindingDefinition jmsBinding) throws XMLStreamException { + String name = reader.getAttributeValue(null, "name"); + if (name != null && name.length() > 0) { + jmsBinding.setDestinationName(name); + } + String type = reader.getAttributeValue(null, "type"); + if (type != null && type.length() > 0) { + if ("queue".equalsIgnoreCase(type)) { + jmsBinding.setDestinationType(JMSBindingDefinition.DESTINATION_TYPE_QUEUE); + } else if ("topic".equalsIgnoreCase("type")) { + jmsBinding.setDestinationType(JMSBindingDefinition.DESTINATION_TYPE_TOPIC); + } else { + throw new RuntimeException("invalid destination type: " + type); + } + } + String create = reader.getAttributeValue(null, "create"); + if (create != null && create.length() > 0) { + jmsBinding.setCreateDestination(create); + } + } + + protected void parseURI(JMSBindingDefinition jmsBinding, String uri) { + // TODO Auto-generated method stub + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java new file mode 100644 index 0000000000..56e367eca2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import java.lang.reflect.Method; + +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageListener; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.naming.NamingException; + +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.Interceptor; +import org.apache.tuscany.spi.wire.InvocationChain; +import org.apache.tuscany.spi.wire.MessageImpl; + +public class JMSProxy implements MessageListener { + + protected Method operationMethod; + protected JMSResourceFactory jmsResourceFactory; + protected OperationAndDataBinding requestOperationAndDataBinding; + protected OperationAndDataBinding responseOperationAndDataBinding; + protected InboundWire inboundWire; + protected String correlationScheme; + + public JMSProxy(InboundWire inboundWire, + JMSResourceFactory jmsResourceFactory, + OperationAndDataBinding requestOperationAndDataBinding, + OperationAndDataBinding responseOperationAndDataBinding, + String correlationScheme) throws NamingException { + + this.jmsResourceFactory = jmsResourceFactory; + this.requestOperationAndDataBinding = requestOperationAndDataBinding; + this.responseOperationAndDataBinding = responseOperationAndDataBinding; + this.inboundWire = inboundWire; + this.correlationScheme = correlationScheme; + } + + public void onMessage(Message requestJMSMsg) { + try { + Object responsePayload = invokeService(requestJMSMsg); + sendReply(requestJMSMsg, responsePayload); + } catch (Exception e) { + sendFaultReply(requestJMSMsg, e); + } + } + + protected Object invokeService(Message requestJMSMsg) throws JMSException { + + String operationName = requestOperationAndDataBinding.getOperationName(requestJMSMsg); + Object requestPayload = requestOperationAndDataBinding.extractPayload(requestJMSMsg); + + Operation op = (Operation)inboundWire.getServiceContract().getOperations().get(operationName); + InvocationChain chain = inboundWire.getInvocationChains().get(op); + + org.apache.tuscany.spi.wire.Message tuscanyRequestMsg = new MessageImpl(); + tuscanyRequestMsg.setTargetInvoker(chain.getTargetInvoker()); + tuscanyRequestMsg.setBody(requestPayload); + + org.apache.tuscany.spi.wire.Message tuscanyResponseMsg = null; + + Interceptor headInterceptor = chain.getHeadInterceptor(); + if (headInterceptor != null) { + tuscanyResponseMsg = headInterceptor.invoke(tuscanyRequestMsg); + } + + // TODO: what if headInterceptor is null? + + return tuscanyResponseMsg.getBody(); + } + + protected void sendReply(Message requestJMSMsg, Object responsePayload) { + try { + + if (requestJMSMsg.getJMSReplyTo() == null) { + // assume no reply is expected + return; + } + + Session session = jmsResourceFactory.createSession(); + Message replyJMSMsg = responseOperationAndDataBinding.createJMSMessage(session, responsePayload); + + replyJMSMsg.setJMSDeliveryMode(requestJMSMsg.getJMSDeliveryMode()); + replyJMSMsg.setJMSPriority(requestJMSMsg.getJMSPriority()); + + if (correlationScheme == null || "RequestMsgIDToCorrelID".equalsIgnoreCase(correlationScheme)) { + replyJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSMessageID()); + } else if ("RequestCorrelIDToCorrelID".equalsIgnoreCase(correlationScheme)) { + replyJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSCorrelationID()); + } + + Destination destination = requestJMSMsg.getJMSReplyTo(); + MessageProducer producer = session.createProducer(destination); + + producer.send(replyJMSMsg); + + producer.close(); + session.close(); + + } catch (JMSException e) { + throw new JMSBindingException(e); + } catch (NamingException e) { + throw new JMSBindingException(e); + } + } + + protected void sendFaultReply(Message requestJMSMsg, Exception e) { + sendReply(requestJMSMsg, new JMSBindingException("exception invoking JMS service", e)); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSReferenceBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSReferenceBinding.java new file mode 100644 index 0000000000..0fdb95af7c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSReferenceBinding.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import javax.jms.Destination; +import javax.xml.namespace.QName; + +import static org.osoa.sca.Constants.SCA_NS; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ReferenceBindingExtension; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.TargetInvoker; + +/** + * @version $Rev: 449970 $ $Date: 2006-09-26 06:05:35 -0400 (Tue, 26 Sep 2006) $ + */ +public class JMSReferenceBinding extends ReferenceBindingExtension { + private static final QName BINDING_JMS = new QName(SCA_NS, "binding.jms"); + + protected JMSBindingDefinition jmsBinding; + protected JMSResourceFactory jmsResourceFactory; + protected OperationAndDataBinding requestOperationAndDataBinding; + protected OperationAndDataBinding responseOperationAndDataBinding; + protected Destination requestDest; + protected Destination replyDest; + + public JMSReferenceBinding(String name, + CompositeComponent parent, + JMSBindingDefinition jmsBinding, + JMSResourceFactory jmsResourceFactory, + ServiceContract bindingServiceContract, + OperationAndDataBinding requestOperationAndDataBinding, + OperationAndDataBinding responseOperationAndDataBinding, + Destination requestDest, + Destination replyDest) { + + super(name, parent); + this.bindingServiceContract = bindingServiceContract; + this.jmsBinding = jmsBinding; + this.jmsResourceFactory = jmsResourceFactory; + this.requestOperationAndDataBinding = requestOperationAndDataBinding; + this.responseOperationAndDataBinding = responseOperationAndDataBinding; + this.requestDest = requestDest; + this.replyDest = replyDest; + } + + public QName getBindingType() { + return BINDING_JMS; + } + + public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) { + return new JMSTargetInvoker(jmsResourceFactory, jmsBinding, operation.getName(), + requestOperationAndDataBinding, responseOperationAndDataBinding, requestDest, + replyDest); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSResourceFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSResourceFactory.java new file mode 100644 index 0000000000..dbc43a6d34 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSResourceFactory.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import javax.jms.Connection; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Session; +import javax.naming.NamingException; + +public interface JMSResourceFactory { + + public abstract Connection getConnection() throws NamingException, JMSException; + + public abstract Session createSession() throws JMSException, NamingException; + + public abstract void startConnection() throws JMSException, NamingException; + + public abstract void closeConnection() throws JMSException, NamingException; + + public abstract Destination lookupDestination(String jndiName) throws NamingException; +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSServiceBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSServiceBinding.java new file mode 100644 index 0000000000..51b4c501d6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSServiceBinding.java @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.MessageConsumer; +import javax.jms.Session; +import javax.naming.NamingException; +import javax.xml.namespace.QName; + +import static org.osoa.sca.Constants.SCA_NS; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ServiceBindingExtension; +import org.apache.tuscany.spi.model.ServiceContract; + +/** + * @version $Rev: 449970 $ $Date: 2006-09-26 06:05:35 -0400 (Tue, 26 Sep 2006) $ + */ +public class JMSServiceBinding extends ServiceBindingExtension { + private static final QName BINDING_JMS = new QName(SCA_NS, "binding.jms"); + + private JMSBindingDefinition jmsBinding; + private JMSResourceFactory jmsResourceFactory; + private MessageConsumer consumer; + protected OperationAndDataBinding requestOperationAndDataBinding; + protected OperationAndDataBinding responseOperationAndDataBinding; + + public JMSServiceBinding(String name, + CompositeComponent parent, + JMSBindingDefinition jmsBinding, + JMSResourceFactory jmsResourceFactory, + ServiceContract serviceBindingContract, + OperationAndDataBinding requestOperationAndDataBinding, + OperationAndDataBinding responseOperationAndDataBinding, + Class service) { + super(name, parent); + + this.jmsBinding = jmsBinding; + this.jmsResourceFactory = jmsResourceFactory; + this.bindingServiceContract = serviceBindingContract; + this.requestOperationAndDataBinding = requestOperationAndDataBinding; + this.responseOperationAndDataBinding = responseOperationAndDataBinding; + } + + public void start() { + super.start(); + try { + registerListerner(); + } catch (Exception e) { + throw new JMSBindingException("Error starting JMSServiceBinding", e); + } + } + + public void stop() { + + try { + consumer.close(); + jmsResourceFactory.closeConnection(); + } catch (Exception e) { + throw new JMSBindingException("Error stopping JMSServiceBinding", e); + } + + super.stop(); + } + + private void registerListerner() throws NamingException, JMSException { + + Session session = jmsResourceFactory.createSession(); + Destination destination = session.createQueue(jmsBinding.getDestinationName()); + + consumer = session.createConsumer(destination); + consumer.setMessageListener(new JMSProxy(getInboundWire(), jmsResourceFactory, requestOperationAndDataBinding, + responseOperationAndDataBinding, jmsBinding.getCorrelationScheme())); + + jmsResourceFactory.startConnection(); + + } + + public QName getBindingType() { + return BINDING_JMS; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSTargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSTargetInvoker.java new file mode 100644 index 0000000000..61e838c41a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSTargetInvoker.java @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import java.lang.reflect.InvocationTargetException; + +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.naming.NamingException; + +import org.apache.tuscany.spi.extension.TargetInvokerExtension; + +/** + * Invoke a JMS reference. + */ +public class JMSTargetInvoker extends TargetInvokerExtension { + + protected JMSBindingDefinition jmsBinding; + protected JMSResourceFactory jmsResourceFactory; + + protected String operationName; + protected OperationAndDataBinding requestOperationAndDataBinding; + protected OperationAndDataBinding responseOperationAndDataBinding; + + protected Destination requestDest; + protected Destination replyDest; + + public JMSTargetInvoker(JMSResourceFactory jmsResourceFactory, + JMSBindingDefinition jmsBinding, + String operationName, + OperationAndDataBinding requestOperationAndDataBinding, + OperationAndDataBinding responseOperationAndDataBinding, + Destination requestDest, + Destination replyDest) { + super(null, null, null); + this.jmsBinding = jmsBinding; + this.jmsResourceFactory = jmsResourceFactory; + this.operationName = operationName; + this.requestOperationAndDataBinding = requestOperationAndDataBinding; + this.responseOperationAndDataBinding = responseOperationAndDataBinding; + this.requestDest = requestDest; + this.replyDest = replyDest; + } + + public Object invokeTarget(Object payload, final short sequence) throws InvocationTargetException { + try { + Session session = jmsResourceFactory.createSession(); + try { + + Destination replyToDest = (replyDest != null) ? replyDest : session.createTemporaryQueue(); + Message requestMsg = sendRequest((Object[])payload, session, replyToDest); + Message replyMsg = receiveReply(session, replyToDest, requestMsg.getJMSMessageID()); + + return responseOperationAndDataBinding.extractPayload(replyMsg); + + } finally { + session.close(); + } + } catch (JMSException e) { + throw new InvocationTargetException(e); + } catch (NamingException e) { + throw new InvocationTargetException(e); + } + } + + protected Message sendRequest(Object[] payload, Session session, Destination replyToDest) throws JMSException { + + Message requestMsg = requestOperationAndDataBinding.createJMSMessage(session, payload); + + requestMsg.setJMSDeliveryMode(jmsBinding.getDeliveryMode()); + requestMsg.setJMSPriority(jmsBinding.getPriority()); + + requestOperationAndDataBinding.setOperationName(operationName, requestMsg); + requestMsg.setJMSReplyTo(replyToDest); + + MessageProducer producer = session.createProducer(requestDest); + try { + producer.send(requestMsg); + } finally { + producer.close(); + } + return requestMsg; + } + + protected Message receiveReply(Session session, Destination replyToDest, String requestMsgId) throws JMSException, + NamingException { + String msgSelector = "JMSCorrelationID = '" + requestMsgId + "'"; + MessageConsumer consumer = session.createConsumer(replyToDest, msgSelector); + Message replyMsg; + try { + jmsResourceFactory.startConnection(); + replyMsg = consumer.receive(jmsBinding.getTimeToLive()); + } finally { + consumer.close(); + } + return replyMsg; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/OperationAndDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/OperationAndDataBinding.java new file mode 100644 index 0000000000..9867f7d97b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/OperationAndDataBinding.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import javax.jms.Message; +import javax.jms.Session; + +/** + * Interface for a component that does operation selection and message payload + * databinding + */ +public interface OperationAndDataBinding { + + /** + * Get the operation name from a JMS Message + */ + public abstract String getOperationName(Message message); + + /** + * Set the operation name on a JMS Message + */ + public abstract void setOperationName(String operationName, Message message); + + /** + * Extracts the payload from a JMS Message + */ + public abstract Object extractPayload(Message msg); + + /** + * Create a JMS Message containing the payload + */ + public abstract Message createJMSMessage(Session session, Object payload); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/SimpleJMSResourceFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/SimpleJMSResourceFactory.java new file mode 100644 index 0000000000..86cdfa272e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/SimpleJMSResourceFactory.java @@ -0,0 +1,114 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import java.util.Properties; + +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Session; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +public class SimpleJMSResourceFactory implements JMSResourceFactory { + + private JMSBindingDefinition jmsBinding; + private Connection con; + private Context context; + private boolean isConnectionStarted; + + public SimpleJMSResourceFactory(JMSBindingDefinition jmsBinding) { + this.jmsBinding = jmsBinding; + } + + /* + * This is a simple implementation where a connection is created per binding + * Ideally the resource factory should be able to leverage the host + * environment to provide connection pooling if it can. For ex If Tuscany is + * running inside an AppServer Then we could leverage the JMS resources it + * provides + * + * @see org.apache.tuscany.binding.jms.JMSResourceFactory#getConnection() + */ + public Connection getConnection() throws NamingException, JMSException { + if (con == null) { + createConnection(); + } + return con; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.binding.jms.JMSResourceFactory#createSession() + */ + public Session createSession() throws JMSException, NamingException { + return getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.binding.jms.JMSResourceFactory#startConnection() + */ + public void startConnection() throws JMSException, NamingException { + if (!isConnectionStarted) { + getConnection().start(); + isConnectionStarted = true; + } + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.binding.jms.JMSResourceFactory#closeConnection() + */ + public void closeConnection() throws JMSException, NamingException { + if (con != null) { + con.close(); + } + } + + private void createConnection() throws NamingException, JMSException { + if (context == null) { + createInitialContext(); + } + ConnectionFactory conFac = (ConnectionFactory)context.lookup(jmsBinding.getConnectionFactoryName()); + con = conFac.createConnection(); + } + + private void createInitialContext() throws NamingException { + Properties props = new Properties(); + props.setProperty(Context.INITIAL_CONTEXT_FACTORY, jmsBinding.getInitialContextFactoryName().trim()); + props.setProperty(Context.PROVIDER_URL, jmsBinding.getJNDIProviderURL().trim()); + + context = new InitialContext(props); + } + + public Destination lookupDestination(String jndiName) throws NamingException { + if (context == null) { + createInitialContext(); + } + return (Destination)context.lookup(jndiName); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/AbstractJmsTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/AbstractJmsTransformer.java new file mode 100644 index 0000000000..d535af71c6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/AbstractJmsTransformer.java @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.binding.jms.databinding; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectStreamClass; + +import org.apache.tuscany.spi.databinding.DataBindingRegistry; +import org.apache.tuscany.spi.databinding.Mediator; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; + +/** + * This is a special transformer to transform the input from one IDL to the + * other one + */ +public abstract class AbstractJmsTransformer extends TransformerExtension implements PullTransformer { + + protected static final String JMS_INPUT = "jms:input"; + protected static final String JMS_OUTPUT = "jms:output"; + + protected DataBindingRegistry dataBindingRegistry; + + protected Mediator mediator; + + public AbstractJmsTransformer() { + super(); + } + + /** + * @see org.apache.tuscany.spi.databinding.Transformer#getWeight() + */ + public int getWeight() { + return 10; + } + + protected Object read(byte[] bytes) { + try { + ByteArrayInputStream bis = new ByteArrayInputStream(bytes); + ObjectInputStream ois = new ObjectInputStream(bis) { + + @Override + protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { + try { + return Class.forName(desc.getName(), false, this.getClass().getClassLoader()); + } catch (ClassNotFoundException e) { + return super.resolveClass(desc); + } + } + + }; + Object object = ois.readObject(); + ois.close(); + bis.close(); + + return object; + } catch (Exception e) { + throw new TransformationException(e); + } + } + + protected byte[] write(Object source) { + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(source); + oos.close(); + bos.close(); + return bos.toByteArray(); + } catch (IOException e) { + throw new TransformationException(e); + } + + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/Input2JmsInputTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/Input2JmsInputTransformer.java new file mode 100644 index 0000000000..568cb21f4f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/Input2JmsInputTransformer.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.binding.jms.databinding; + +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.osoa.sca.annotations.Service; + +/** + * This is a special transformer to transform the input from one IDL to the + * other one + */ +@Service(Transformer.class) +public class Input2JmsInputTransformer extends AbstractJmsTransformer { + + public Input2JmsInputTransformer() { + super(); + } + + @Override + public String getSourceDataBinding() { + return DataBinding.IDL_INPUT; + } + + @Override + public String getTargetDataBinding() { + return JMS_INPUT; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType() + */ + @Override + protected Class getSourceType() { + return Object[].class; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType() + */ + @Override + protected Class getTargetType() { + return Object[].class; + } + + @SuppressWarnings("unchecked") + public Object[] transform(Object[] source, TransformationContext context) { + return new Object[] {write(source)}; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsInput2InputTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsInput2InputTransformer.java new file mode 100644 index 0000000000..4055e4ce86 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsInput2InputTransformer.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.binding.jms.databinding; + +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.osoa.sca.annotations.Service; + +/** + * This is a special transformer to transform the input from one IDL to the + * other one + */ +@Service(Transformer.class) +public class JmsInput2InputTransformer extends AbstractJmsTransformer { + + public JmsInput2InputTransformer() { + super(); + } + + @Override + public String getSourceDataBinding() { + return JMS_INPUT; + } + + @Override + public String getTargetDataBinding() { + return DataBinding.IDL_INPUT; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType() + */ + @Override + protected Class getSourceType() { + return Object[].class; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType() + */ + @Override + protected Class getTargetType() { + return Object[].class; + } + + @SuppressWarnings("unchecked") + public Object[] transform(Object[] source, TransformationContext context) { + return (Object[])read((byte[])source[0]); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsOutput2OutputTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsOutput2OutputTransformer.java new file mode 100644 index 0000000000..35ac98ec51 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsOutput2OutputTransformer.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.binding.jms.databinding; + +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.osoa.sca.annotations.Service; + +/** + * This is a special transformer to transform the output from one IDL to the + * other one + */ +@Service(Transformer.class) +public class JmsOutput2OutputTransformer extends AbstractJmsTransformer { + + /** + * @param wrapperHandler + */ + public JmsOutput2OutputTransformer() { + super(); + } + + @Override + public String getSourceDataBinding() { + return JMS_OUTPUT; + } + + @Override + public String getTargetDataBinding() { + return DataBinding.IDL_OUTPUT; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType() + */ + @Override + protected Class getSourceType() { + return Object.class; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType() + */ + @Override + protected Class getTargetType() { + return Object.class; + } + + @SuppressWarnings("unchecked") + public Object transform(Object response, TransformationContext context) { + return read((byte[])response); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/Output2JmsOutputTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/Output2JmsOutputTransformer.java new file mode 100644 index 0000000000..6786491091 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/Output2JmsOutputTransformer.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.binding.jms.databinding; + +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.osoa.sca.annotations.Service; + +/** + * This is a special transformer to transform the output from one IDL to the + * other one + */ +@Service(Transformer.class) +public class Output2JmsOutputTransformer extends AbstractJmsTransformer { + /** + * @param wrapperHandler + */ + public Output2JmsOutputTransformer() { + super(); + } + + @Override + public String getSourceDataBinding() { + return DataBinding.IDL_OUTPUT; + } + + @Override + public String getTargetDataBinding() { + return JMS_OUTPUT; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType() + */ + @Override + protected Class getSourceType() { + return Object.class; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType() + */ + @Override + protected Class getTargetType() { + return Object.class; + } + + @SuppressWarnings("unchecked") + public Object transform(Object response, TransformationContext context) { + return write(response); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/binding.jms.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/binding.jms.scdl new file mode 100644 index 0000000000..7bc0691c57 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/binding.jms.scdl @@ -0,0 +1,52 @@ + + + + + org.apache.tuscany.sca.extensions.jms + tuscany-jms + 1.0-incubator-SNAPSHOT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..fe1704eb39 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,52 @@ + + + + + org.apache.tuscany.sca.extensions.jms + tuscany-jms + 1.0-incubator-SNAPSHOT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/extension.composite new file mode 100644 index 0000000000..ee865ce923 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/extension.composite @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/GreetingService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/GreetingService.java new file mode 100644 index 0000000000..24472afa53 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/GreetingService.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface GreetingService { + String greet(String name); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/GreetingServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/GreetingServiceImpl.java new file mode 100644 index 0000000000..abf7ecef88 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/GreetingServiceImpl.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +public class GreetingServiceImpl implements GreetingService { + + public String greet(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/HelloworldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/HelloworldService.java new file mode 100644 index 0000000000..21c40bd6b6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/HelloworldService.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface HelloworldService { + String getGreetings(String name); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/HelloworldServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/HelloworldServiceImpl.java new file mode 100644 index 0000000000..8119bde323 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/HelloworldServiceImpl.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +public class HelloworldServiceImpl implements HelloworldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/IntroService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/IntroService.java new file mode 100644 index 0000000000..0b5acb44cc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/IntroService.java @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +public interface IntroService { + public String greet(String name); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/IntroServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/IntroServiceImpl.java new file mode 100644 index 0000000000..6222f368ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/IntroServiceImpl.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import org.osoa.sca.annotations.Reference; + +public class IntroServiceImpl implements IntroService { + + private GreetingService extService; + + @Reference + public void setExtService(GreetingService extService) { + this.extService = extService; + } + + public String greet(String name) { + return extService.greet(name); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java new file mode 100644 index 0000000000..646432d81e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java @@ -0,0 +1,91 @@ +package org.apache.tuscany.binding.jms; + +import java.io.StringReader; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import junit.framework.TestCase; + +import org.apache.tuscany.spi.loader.LoaderException; +import static org.osoa.sca.Constants.SCA_NS; + +public class JMSBindingLoaderTestCase extends TestCase { + + private JMSBindingLoader loader; + + public void testMinimal() throws LoaderException, XMLStreamException { + String xml = ""; + XMLStreamReader reader = createReader(xml); + JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null); + assertNotNull(jmsBinding); + } + + public void testCorrelationScheme() throws LoaderException, XMLStreamException { + XMLStreamReader reader = + createReader(""); + JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null); + assertEquals("RequestMsgIDToCorrelID", jmsBinding.getCorrelationScheme()); + + reader = createReader(""); + jmsBinding = loader.load(null, null, reader, null); + assertEquals("RequestCorrelIDToCorrelID", jmsBinding.getCorrelationScheme()); + + reader = createReader(""); + jmsBinding = loader.load(null, null, reader, null); + assertEquals("none", jmsBinding.getCorrelationScheme()); + + reader = createReader(""); + try { + jmsBinding = loader.load(null, null, reader, null); + fail("expecting invalid correlationScheme"); + } catch (LoaderException e) { + // expected + } + } + + public void testDestination() throws LoaderException, XMLStreamException { + XMLStreamReader reader = createReader(""); + JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null); + assertEquals("foo", jmsBinding.getDestinationName()); + } + + public void testInitialContextFactory() throws LoaderException, XMLStreamException { + XMLStreamReader reader = createReader(""); + JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null); + assertEquals("myicf", jmsBinding.getInitialContextFactoryName()); + } + + public void testJNDIProviderURL() throws LoaderException, XMLStreamException { + XMLStreamReader reader = createReader(""); + JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null); + assertEquals("myURL", jmsBinding.getJNDIProviderURL()); + } + + public void testConnectionFactory() throws LoaderException, XMLStreamException { + XMLStreamReader reader = createReader(" "); + JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null); + assertEquals("myfactory", jmsBinding.getConnectionFactoryName()); + } + + public void testActivationSpec() throws LoaderException, XMLStreamException { + XMLStreamReader reader = createReader(" "); + JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null); + assertEquals("myas", jmsBinding.getActivationSpecName()); + } + + private XMLStreamReader createReader(String xml) throws XMLStreamException { + XMLInputFactory factory = XMLInputFactory.newInstance(); + + String xxx = "" + xml + ""; + XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(xxx)); + reader.nextTag(); + reader.nextTag(); + return reader; + } + + protected void setUp() throws Exception { + this.loader = new JMSBindingLoader(null); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSBindingTestCaseX.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSBindingTestCaseX.java new file mode 100644 index 0000000000..8479f27532 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSBindingTestCaseX.java @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; + +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.naming.NamingException; +import javax.xml.parsers.ParserConfigurationException; + +import junit.framework.TestCase; + +import org.activemq.broker.BrokerContainer; +import org.activemq.broker.impl.BrokerContainerImpl; +import org.activemq.store.vm.VMPersistenceAdapter; +import org.apache.tuscany.api.SCARuntime; +import org.custommonkey.xmlunit.Diff; +import org.custommonkey.xmlunit.XMLUnit; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; +import org.xml.sax.SAXException; + +public class JMSBindingTestCaseX extends TestCase { + + private IntroService introService; + private BrokerContainer broker; + + protected static final String REQUEST_XML = + "petra"; + protected static final String REPLY_XML = + "Hello petra"; + + public void testJMSBinding() throws InvocationTargetException, SAXException, IOException, + ParserConfigurationException, NamingException, JMSException { + String reply = introService.greet("Rajith"); + assertEquals("Hello Rajith", reply); + + // TODO: the rest should be in a seperate test method but that doesn't + // work as you get broker conflicts + JMSTargetInvoker invoker = createJMSInvoker(); + Object[] response = (Object[])invoker.invokeTarget(new Object[] {REQUEST_XML}, (short)0); + + Diff diff = XMLUnit.compareXML(REPLY_XML, response[0].toString()); + assertTrue(diff.toString(), diff.similar()); + + } + + private JMSTargetInvoker createJMSInvoker() throws NamingException, JMSException { + JMSBindingDefinition binding = new JMSBindingDefinition(); + binding.setInitialContextFactoryName("org.activemq.jndi.ActiveMQInitialContextFactory"); + binding.setConnectionFactoryName("ConnectionFactory"); + binding.setJNDIProviderURL("tcp://localhost:61616"); + binding.setDestinationName("dynamicQueues/HelloworldServiceQueue"); + binding.setTimeToLive(3000); + binding.setXMLFormat(true); + JMSResourceFactory rf = new SimpleJMSResourceFactory(binding); + Destination requestDest = rf.lookupDestination(binding.getDestinationName()); + DefaultOperationAndDataBinding odb = new DefaultOperationAndDataBinding(binding); + JMSTargetInvoker invoker = new JMSTargetInvoker(rf, binding, "getGreetings", odb, odb, requestDest, null); + return invoker; + } + + protected void setUp() throws Exception { + startBroker(); + SCARuntime.start("META-INF/sca/default.scdl"); + super.setUp(); + CompositeContext context = CurrentCompositeContext.getContext(); + introService = context.locateService(IntroService.class, "IntroServiceComponent"); + } + + protected void tearDown() throws Exception { + super.tearDown(); + broker.stop(); + } + + public static void main(String[] args) { + JMSBindingTestCaseX test = new JMSBindingTestCaseX(); + try { + test.setUp(); + test.testJMSBinding(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void startBroker() throws Exception { + broker = new BrokerContainerImpl("JMS BindingDefinition Test"); + // configure the broker + broker.addConnector("tcp://localhost:61616"); + broker.setPersistenceAdapter(new VMPersistenceAdapter()); + broker.start(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSProxyTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSProxyTestCase.java new file mode 100644 index 0000000000..63a82ab6da --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSProxyTestCase.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageProducer; +import javax.jms.ObjectMessage; +import javax.jms.Session; +import javax.naming.NamingException; + +import junit.framework.TestCase; + +import org.easymock.EasyMock; + +public class JMSProxyTestCase extends TestCase { + + /** + * Tests the jms response msg has correlation id set to the request msg id + */ + public void testOnMessageRequestMsgIDToCorrelID() throws NamingException, JMSException { + + String id = "123"; + + MessageProducer producer = EasyMock.createNiceMock(MessageProducer.class); + + Session session = EasyMock.createNiceMock(Session.class); + EasyMock.expect(session.createProducer(EasyMock.isA(Destination.class))).andReturn(producer); + EasyMock.replay(session); + + ObjectMessage responseJMSMsg = EasyMock.createMock(ObjectMessage.class); + responseJMSMsg.setJMSDeliveryMode(1); + responseJMSMsg.setJMSPriority(1); + responseJMSMsg.setJMSCorrelationID(id); + EasyMock.replay(responseJMSMsg); + + JMSResourceFactory jmsResourceFactory = EasyMock.createMock(JMSResourceFactory.class); + EasyMock.expect(jmsResourceFactory.createSession()).andReturn(session); + + OperationAndDataBinding odb = EasyMock.createMock(OperationAndDataBinding.class); + EasyMock.expect(odb.createJMSMessage(EasyMock.eq(session), EasyMock.isA(Exception.class))) + .andReturn(responseJMSMsg); + EasyMock.replay(odb); + + JMSProxy jmsProxy = new JMSProxy(null, jmsResourceFactory, null, odb, null); + + Message requestJMSMsg = EasyMock.createMock(Message.class); + EasyMock.expect(requestJMSMsg.getJMSReplyTo()).andReturn(new Destination() { + }); + + EasyMock.expect(requestJMSMsg.getJMSDeliveryMode()).andReturn(1); + EasyMock.expect(requestJMSMsg.getJMSPriority()).andReturn(1); + + EasyMock.expect(requestJMSMsg.getJMSReplyTo()).andReturn(new Destination() { + }); + EasyMock.expect(requestJMSMsg.getJMSMessageID()).andReturn(id); + + producer.send(EasyMock.isA(Message.class)); + EasyMock.replay(producer); + + EasyMock.replay(requestJMSMsg); + EasyMock.replay(jmsResourceFactory); + + jmsProxy.onMessage(requestJMSMsg); + + EasyMock.verify(requestJMSMsg); + EasyMock.verify(jmsResourceFactory); + EasyMock.verify(producer); + EasyMock.verify(session); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/databinding/JmsTransformerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/databinding/JmsTransformerTestCase.java new file mode 100644 index 0000000000..7c9420b7f9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/databinding/JmsTransformerTestCase.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.binding.jms.databinding; + +import junit.framework.TestCase; + +/** + * Test cases for transformers + */ +public class JmsTransformerTestCase extends TestCase { + private Input2JmsInputTransformer t1; + private JmsInput2InputTransformer t2; + private Output2JmsOutputTransformer t3; + private JmsOutput2OutputTransformer t4; + + /** + * @see junit.framework.TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + t1 = new Input2JmsInputTransformer(); + t2 = new JmsInput2InputTransformer(); + t3 = new Output2JmsOutputTransformer(); + t4 = new JmsOutput2OutputTransformer(); + } + + public void testInput() { + Object[] args1 = new Object[] {1, "ABC", 1.0d}; + Object[] args2 = t1.transform(args1, null); + assertEquals(1, args2.length); + assertTrue(args2[0] instanceof byte[]); + Object[] args3 = t2.transform(args2, null); + for (int i = 0; i < args3.length; i++) { + assertEquals(args1[i], args3[i]); + } + + } + + public void testOutput() { + Object args1 = "ABC"; + Object args2 = t3.transform(args1, null); + assertTrue(args2 instanceof byte[]); + Object args3 = t4.transform(args2, null); + assertEquals(args1, args3); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..7291363978 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/resources/META-INF/sca/default.scdl @@ -0,0 +1,61 @@ + + + + + + + + + + GretingServiceComponent + + + + + + + + + GreetingJMSReference + + + + + + + + + + + + + + + + + HelloworldComponent + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..f1a62d8570 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/resources/wsdl/helloworld.wsdl @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/pom.xml new file mode 100644 index 0000000000..5f6aecd9ee --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/pom.xml @@ -0,0 +1,66 @@ + + + + + + org.apache.tuscany.sca.extensions + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.jms + parent + pom + Tuscany JMS Extension + + + binding + samples + + + + + + + activemq + activemq-core + 3.2 + compile + + + + geronimo-spec + geronimo-spec-jms + 1.1-rc4 + compile + + + + geronimo-spec + geronimo-spec-j2ee-management + 1.0-rc4 + compile + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/pom.xml new file mode 100644 index 0000000000..6439099456 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/pom.xml @@ -0,0 +1,77 @@ + + + + + org.apache.tuscany.sca.extensions.jms.samples + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + sample-helloworld-jmsReference + jar + Tuscany JMS Reference Helloworld Sample + A helloworld sample using a JMS Reference + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + org.apache.tuscany.sca.extensions.jms + tuscany-jms + ${extensionVersion} + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.HelloWorldJmsClient + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..6195be003a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService +{ + @Reference + private HelloWorldService extService = null; + + public HelloWorldService getExtService() { + return extService; + } + + @Reference + public void setExtService(HelloWorldService extService) { + this.extService = extService; + } + + public String sayHello(String name) + { + return extService.sayHello(name); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..13f0574a0f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + + + +/** + * This is the business interface of the HelloWorld greetings service. + */ +public interface HelloWorldService { + + public String sayHello(String name) ; + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..01930b3aaf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,36 @@ + + + + + + + HelloWorldJmsService + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/test/java/helloworld/HelloWorldJmsClient.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/test/java/helloworld/HelloWorldJmsClient.java new file mode 100644 index 0000000000..4a8a8fb249 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/test/java/helloworld/HelloWorldJmsClient.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * @author administrator + * + */ +public class HelloWorldJmsClient extends TestCase{ + private HelloWorldService helloWorldService; + protected void setUp() throws Exception { + SCARuntime.start("META-INF/sca/default.scdl"); + + CompositeContext context = CurrentCompositeContext.getContext(); + helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldServiceComponent"); + } + + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + + public void testHelloWorld(){ + assertEquals("Hello World", helloWorldService.sayHello("World")); + } + public static void main(String[] args) { + try { + HelloWorldJmsClient helloWorldJmsServer = new HelloWorldJmsClient(); + helloWorldJmsServer.setUp(); + helloWorldJmsServer.testHelloWorld(); + } catch ( Exception e ) { + e.printStackTrace(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/pom.xml new file mode 100644 index 0000000000..217b8b5575 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/pom.xml @@ -0,0 +1,76 @@ + + + + + org.apache.tuscany.sca.extensions.jms.samples + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + sample-helloworld-jmsService + jar + Tuscany JMS Service Helloworld Sample + A helloworld sample hosting JMS Service + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.extensions.jms + tuscany-jms + ${extensionVersion} + test + + + + junit + junit + 4.2 + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.HelloWorldJmsServer + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..342d8813e6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService +{ + + public String sayHello(String name) + { + System.out.println("[HelloWorld from JMSBinding] " + "Hello " + name); + return "Hello " + name; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..ef86a04f77 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + + + +/** + * This is the business interface of the HelloWorld greetings service. + */ +public interface HelloWorldService { + + public String sayHello(String name); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..a3b335f292 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,36 @@ + + + + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/test/java/helloworld/HelloWorldJmsServer.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/test/java/helloworld/HelloWorldJmsServer.java new file mode 100644 index 0000000000..44f9b9bc3c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/test/java/helloworld/HelloWorldJmsServer.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import junit.framework.TestCase; + +import org.activemq.broker.BrokerContainer; +import org.activemq.broker.impl.BrokerContainerImpl; +import org.activemq.store.vm.VMPersistenceAdapter; +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CurrentCompositeContext; + + +/** + * @author administrator + */ +public class HelloWorldJmsServer extends TestCase{ + private BrokerContainer broker; + + public HelloWorldJmsServer() { + if (broker == null) + broker = new BrokerContainerImpl("JMS BindingDefinition Test"); + } + + private void startBroker() throws Exception { + // configure the broker + broker.addConnector("tcp://localhost:61616"); + broker.setPersistenceAdapter(new VMPersistenceAdapter()); + broker.start(); + } + + protected void setUp() throws Exception { + startBroker(); + SCARuntime.start( "META-INF/sca/default.scdl"); + + CurrentCompositeContext.getContext(); + } + + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + + public void testJMSServer(){ + try { + System.out.println("Service Started and Running..."); + System.out.println("Hit ENTER to exit"); + System.in.read(); + System.out.println("Server Stopped!"); + System.exit(0); + } catch ( Exception e ) { + e.printStackTrace(); + } + } + public static void main(String[] args) { + try { + HelloWorldJmsServer helloWorldJmsServer = new HelloWorldJmsServer(); + helloWorldJmsServer.setUp(); + helloWorldJmsServer.testJMSServer(); + } catch ( Exception e ) { + e.printStackTrace(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/pom.xml new file mode 100644 index 0000000000..ee6af3fa90 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/pom.xml @@ -0,0 +1,97 @@ + + + + + + org.apache.tuscany.sca.extensions.jms + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.jms.samples + parent + pom + Tuscany Samples for the JMS extension + + + + + apache.snapshots + Apache Snapshot Repository + http://people.apache.org/repo/m2-snapshot-repository + + false + + + true + + + + apache.incubator + Apache Incubator Repository + http://people.apache.org/repo/m2-incubating-repository/ + + true + + + false + + + + + + helloworld.jmsService + helloworld.jmsReference + + + + + + org.codehaus.mojo + dependency-maven-plugin + + + + org.apache.tuscany.distribution.sca + standalone + ${scaImplVersion} + bin + zip + + + ${project.build.directory}/distribution + + + + + + + + + org.osoa + sca-api-r1.0 + 0.1-integration-incubating-SNAPSHOT + compile + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/.ruleset new file mode 100644 index 0000000000..ac8671859d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/.ruleset @@ -0,0 +1,190 @@ + + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/LICENSE.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/pom.xml new file mode 100644 index 0000000000..f01aafafab --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/pom.xml @@ -0,0 +1,71 @@ + + + + + + org.apache.tuscany.sca.extensions.jsonrpc + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-jsonrpc + Apache Tuscany Binding for JSON-RPC + Implementation of the SCA JSON-RPC Binding + + + + + org.apache.tuscany.sca.kernel + tuscany-spi + + + + com.metaparadigm + json-rpc + + + + javax.servlet + servlet-api + 2.5 + + + + org.easymock + easymockclassextension + + + + net.sf.json-lib + json-lib + test + + + + httpunit + httpunit + test + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilder.java new file mode 100644 index 0000000000..0f78a641c6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilder.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.ServiceBinding; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.BindingBuilderExtension; +import org.apache.tuscany.spi.host.ServletHost; +import org.apache.tuscany.spi.model.ServiceDefinition; +import org.apache.tuscany.spi.wire.WireService; + +/** + * Builds a Service for JSON-RPC binding. + * + * @version $Rev$ $Date$ + */ +public class JSONRPCBindingBuilder extends BindingBuilderExtension { + + private ServletHost servletHost; + private WireService wireService; + + @Autowire() + public void setServletHost(ServletHost servletHost) { + this.servletHost = servletHost; + } + + @Autowire + public void setWireService(WireService wireService) { + this.wireService = wireService; + } + + + public ServletHost getServletHost() { + return servletHost; + } + + protected Class getBindingType() { + return JSONRPCBindingDefinition.class; + } + + @SuppressWarnings("unchecked") + public ServiceBinding build(CompositeComponent parent, + ServiceDefinition serviceDefinition, + JSONRPCBindingDefinition bindingDefinition, DeploymentContext deploymentContext) { + return new JSONRPCServiceBinding(serviceDefinition.getName(), parent, this.wireService, servletHost); + } + +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingDefinition.java new file mode 100644 index 0000000000..dc785e066a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingDefinition.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +import org.apache.tuscany.spi.model.BindingDefinition; + +/** + * Represents a binding to an RMI service. + * + * @version $Rev$ $Date$ + */ +public class JSONRPCBindingDefinition extends BindingDefinition { + String uri; + + public String getURI() { + return uri; + } + + public void setURI(String uri) { + this.uri = uri; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoader.java new file mode 100644 index 0000000000..71d6623b0d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoader.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +import static org.osoa.sca.Constants.SCA_NS; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.model.ModelObject; +import org.osoa.sca.annotations.Scope; + +/** + * Loader for handling elements. + * + * @version $Rev$ $Date$ + */ +@Scope("COMPOSITE") +public class JSONRPCBindingLoader extends LoaderExtension { + public static final QName BINDING_JSON = new QName(SCA_NS, "binding.jsonrpc"); + + public JSONRPCBindingLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + public QName getXMLType() { + return BINDING_JSON; + } + + public JSONRPCBindingDefinition load(CompositeComponent parent, ModelObject object, XMLStreamReader reader, DeploymentContext deploymentContext) throws XMLStreamException, + LoaderException { + + return new JSONRPCBindingDefinition(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServlet.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServlet.java new file mode 100644 index 0000000000..4407949f2e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServlet.java @@ -0,0 +1,141 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +import java.io.BufferedReader; +import java.io.CharArrayWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.text.ParseException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.tuscany.binding.jsonrpc.util.JavaToSmd; +import org.json.JSONObject; + +import com.metaparadigm.jsonrpc.JSONRPCBridge; +import com.metaparadigm.jsonrpc.JSONRPCResult; +import com.metaparadigm.jsonrpc.JSONRPCServlet; + +/** + * + * + */ +public class JSONRPCEntryPointServlet extends JSONRPCServlet { + private static final long serialVersionUID = 1L; + + private static final int BUF_SIZE = 4096; + + String serviceName; + + Object serviceInstance; + + Class serviceInterface; + + // default constructor for unit testing + public JSONRPCEntryPointServlet() { + } + + public JSONRPCEntryPointServlet(String serviceName, Class serviceInterface, Object serviceInstance) { + this.serviceName = serviceName; + this.serviceInterface = serviceInterface; + this.serviceInstance = serviceInstance; + } + + @Override + public void service(HttpServletRequest request, HttpServletResponse response) + throws IOException, ClassCastException { + + // if there is a smd parameter, we should retrun the SMD for this service + if (request.getParameter("smd") != null) { + String serviceUrl = request.getRequestURL().toString(); + String smd = JavaToSmd.interfaceToSmd(serviceInterface, serviceUrl); + + response.setContentType("text/plain;charset=utf-8"); + OutputStream out = response.getOutputStream(); + byte[] bout = smd.getBytes("UTF-8"); + + out.write(bout); + out.flush(); + out.close(); + } else { + /* + * Create a new bridge for every request to aviod all the problems with + * JSON-RPC-Java storing the bridge in the session + */ + HttpSession session = request.getSession(); + + JSONRPCBridge jsonrpcBridge = new JSONRPCBridge(); + jsonrpcBridge.registerObject(serviceName, serviceInstance, serviceInterface); + session.setAttribute("JSONRPCBridge", jsonrpcBridge); + + // Encode using UTF-8, although We are actually ASCII clean as + // all unicode data is JSON escaped using backslash u. This is + // less data efficient for foreign character sets but it is + // needed to support naughty browsers such as Konqueror and Safari + // which do not honour the charset set in the response + response.setContentType("text/plain;charset=utf-8"); + OutputStream out = response.getOutputStream(); + + // Decode using the charset in the request if it exists otherwise + // use UTF-8 as this is what all browser implementations use. + // The JSON-RPC-Java JavaScript client is ASCII clean so it + // although here we can correctly handle data from other clients + // that do not escape non ASCII data + String charset = request.getCharacterEncoding(); + if (charset == null) { + charset = "UTF-8"; + } + BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream(), charset)); + + // Read the request + CharArrayWriter data = new CharArrayWriter(); + char buf[] = new char[BUF_SIZE]; + int ret; + while ((ret = in.read(buf, 0, BUF_SIZE)) != -1) { + data.write(buf, 0, ret); + } + + // Process the request + JSONObject jsonReq = null; + JSONRPCResult jsonResp = null; + try { + jsonReq = new JSONObject(data.toString()); + String method = jsonReq.getString("method"); + if ((method != null) && (method.indexOf('.') < 0)) { + jsonReq.putOpt("method", serviceName + "." + method); + } + jsonResp = jsonrpcBridge.call(new Object[] {request}, jsonReq); + } catch (ParseException e) { + throw new RuntimeException("Unable to parse request", e); + } + + byte[] bout = jsonResp.toString().getBytes("UTF-8"); + + out.write(bout); + out.flush(); + out.close(); + + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCServiceBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCServiceBinding.java new file mode 100644 index 0000000000..06105ee869 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCServiceBinding.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +import javax.xml.namespace.QName; + +import static org.osoa.sca.Constants.SCA_NS; +import org.osoa.sca.annotations.Destroy; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ServiceBindingExtension; +import org.apache.tuscany.spi.host.ServletHost; +import org.apache.tuscany.spi.wire.WireService; + +/** + * @version $Rev$ $Date$ + */ +public class JSONRPCServiceBinding extends ServiceBindingExtension { + public static final QName BINDING_JSON = new QName(SCA_NS, "binding.jsonrpc"); + + private static int servletRegistrationCount = 0; + + private ServletHost servletHost; + + private WireService wireService; + + public static final String SCRIPT_GETTER_SERVICE_MAPPING = "/SCA/scripts"; + + public JSONRPCServiceBinding(String theName, CompositeComponent parent, WireService wireService, + ServletHost servletHost) { + + super(theName, parent); + + this.servletHost = servletHost; + this.wireService = wireService; + } + + public synchronized void start() { + super.start(); + JSONRPCEntryPointServlet servlet; + // FIXME this should not have to create a proxy but should instead dispatch directly down an invocation chain + Class aClass = getInboundWire().getServiceContract().getInterfaceClass(); + Object instance = + wireService.createProxy(aClass, getInboundWire()); + servlet = new JSONRPCEntryPointServlet(getName(), aClass, instance); + + // register the servlet based on the service name + servletHost.registerMapping("/" + getName(), servlet); + + // if the script getter servlet is not already registered then register it + if ((servletRegistrationCount == 0) && (!servletHost.isMappingRegistered("/SCA/scripts"))) { + servletHost.registerMapping(SCRIPT_GETTER_SERVICE_MAPPING, new ScriptGetterServlet()); + } + + // increase the registered servlet count + servletRegistrationCount++; + } + + @Destroy + public synchronized void stop() { + // unregister the service servlet + servletHost.unregisterMapping("/" + getName()); + + // decrement the registered servlet count + servletRegistrationCount--; + + // if this was the last servlet, we can now unregister the script getter servlet + if (servletRegistrationCount == 0) { + servletHost.unregisterMapping(SCRIPT_GETTER_SERVICE_MAPPING); + } + + super.stop(); + } + + public QName getBindingType() { + return BINDING_JSON; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServlet.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServlet.java new file mode 100644 index 0000000000..50e8ed7ae0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServlet.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ScriptGetterServlet extends HttpServlet { + + private static final long serialVersionUID = 1L; + + // private static final String SCA_INIT_JS = "SCA = new JSONRpcClient(\"serviceBindings/HelloWorldService\");"; + + public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + URL url = getClass().getResource("jsonrpc.js"); + InputStream is = url.openStream(); + writeToStream(response, is); + + // writeToStream(response, new ByteArrayInputStream(SCA_INIT_JS.getBytes())); + } + + private void writeToStream(HttpServletResponse response, InputStream is) throws IOException { + ServletOutputStream os = response.getOutputStream(); + int i; + while ((i = is.read()) != -1) { // NOPMD + os.write(i); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/util/JavaToSmd.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/util/JavaToSmd.java new file mode 100644 index 0000000000..537fccc967 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/util/JavaToSmd.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.tuscany.binding.jsonrpc.util; + +import java.lang.reflect.Method; + + +public class JavaToSmd { + + public static String interfaceToSmd(Class klazz, String serviceUrl) { + String name = klazz.getSimpleName(); + Method methods[] = klazz.getMethods(); + + StringBuffer smdSb = new StringBuffer(); + smdSb.append("{\"SMDVersion\":\".1\",\"objectName\":\"" + name + "\",\"serviceType\":\"JSON-RPC\",\"serviceURL\":\""+ serviceUrl + "\",\"methods\":["); + for (int i = 0; i < methods.length; i++) { + if (i != 0) smdSb.append(","); + Class params[] = methods[i].getParameterTypes(); + smdSb.append("{\"name\":\""+methods[i].getName() + "\",\"parameters\":["); + for (int j = 0; j < params.length; j++) { + if (j != 0) smdSb.append(","); + // right now Dojo doesn't look at the type value, so we'll default it to STRING + // also, since we can't introspect the method paramater names we'll just create an incrementing parameter name + smdSb.append("{\"name\":\"param" + j + "\",\"type\":\"STRING\"}"); + } + smdSb.append("]}"); + } + smdSb.append("]}"); + + return smdSb.toString(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/binding.jsonrpc.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/binding.jsonrpc.scdl new file mode 100644 index 0000000000..2777607424 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/binding.jsonrpc.scdl @@ -0,0 +1,42 @@ + + + + + + + org.apache.tuscany.sca.extensions.jsonrpc + tuscany-jsonrpc + 1.0-incubator-SNAPSHOT + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..7bb1a4e02f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,43 @@ + + + + + + + org.apache.tuscany.sca.extensions.jsonrpc + tuscany-jsonrpc + 1.0-incubator-SNAPSHOT + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/extension.composite new file mode 100644 index 0000000000..83c194b4d7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/extension.composite @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/org/apache/tuscany/binding/jsonrpc/jsonrpc.js b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/org/apache/tuscany/binding/jsonrpc/jsonrpc.js new file mode 100644 index 0000000000..2b9efbb55c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/org/apache/tuscany/binding/jsonrpc/jsonrpc.js @@ -0,0 +1,484 @@ +/* + * JSON-RPC JavaScript client + * + * $Id: jsonrpc.js,v 1.36.2.3 2006/03/08 15:09:37 mclark Exp $ + * + * Copyright (c) 2003-2004 Jan-Klaas Kollhof + * Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd + * + * This code is based on Jan-Klaas' JavaScript o lait library (jsolait). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + +/* escape a character */ + +escapeJSONChar = +function escapeJSONChar(c) +{ + if(c == "\"" || c == "\\") return "\\" + c; + else if (c == "\b") return "\\b"; + else if (c == "\f") return "\\f"; + else if (c == "\n") return "\\n"; + else if (c == "\r") return "\\r"; + else if (c == "\t") return "\\t"; + var hex = c.charCodeAt(0).toString(16); + if(hex.length == 1) return "\\u000" + hex; + else if(hex.length == 2) return "\\u00" + hex; + else if(hex.length == 3) return "\\u0" + hex; + else return "\\u" + hex; +}; + + +/* encode a string into JSON format */ + +escapeJSONString = +function escapeJSONString(s) +{ + /* The following should suffice but Safari's regex is b0rken + (doesn't support callback substitutions) + return "\"" + s.replace(/([^\u0020-\u007f]|[\\\"])/g, + escapeJSONChar) + "\""; + */ + + /* Rather inefficient way to do it */ + var parts = s.split(""); + for(var i=0; i < parts.length; i++) { + var c =parts[i]; + if(c == '"' || + c == '\\' || + c.charCodeAt(0) < 32 || + c.charCodeAt(0) >= 128) + parts[i] = escapeJSONChar(parts[i]); + } + return "\"" + parts.join("") + "\""; +}; + + +/* Marshall objects to JSON format */ + +toJSON = function toJSON(o) +{ + if(o == null) { + return "null"; + } else if(o.constructor == String) { + return escapeJSONString(o); + } else if(o.constructor == Number) { + return o.toString(); + } else if(o.constructor == Boolean) { + return o.toString(); + } else if(o.constructor == Date) { + return '{javaClass: "java.util.Date", time: ' + o.valueOf() +'}'; + } else if(o.constructor == Array) { + var v = []; + for(var i = 0; i < o.length; i++) v.push(toJSON(o[i])); + return "[" + v.join(", ") + "]"; + } else { + var v = []; + for(attr in o) { + if(o[attr] == null) v.push("\"" + attr + "\": null"); + else if(typeof o[attr] == "function"); /* skip */ + else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr])); + } + return "{" + v.join(", ") + "}"; + } +}; + + +/* JSONRpcClient constructor */ + +JSONRpcClient = +function JSONRpcClient_ctor(serverURL, user, pass, objectID) +{ + this.serverURL = serverURL; + this.user = user; + this.pass = pass; + this.objectID = objectID; + + /* Add standard methods */ + if(this.objectID) { + this._addMethods(["listMethods"]); + var req = this._makeRequest("listMethods", []); + } else { + this._addMethods(["system.listMethods"]); + var req = this._makeRequest("system.listMethods", []); + } + var m = this._sendRequest(req); + this._addMethods(m); +}; + + +/* JSONRpcCLient.Exception */ + +JSONRpcClient.Exception = +function JSONRpcClient_Exception_ctor(code, message, javaStack) +{ + this.code = code; + var name; + if(javaStack) { + this.javaStack = javaStack; + var m = javaStack.match(/^([^:]*)/); + if(m) name = m[0]; + } + if(name) this.name = name; + else this.name = "JSONRpcClientException"; + this.message = message; +}; + +JSONRpcClient.Exception.CODE_REMOTE_EXCEPTION = 490; +JSONRpcClient.Exception.CODE_ERR_CLIENT = 550; +JSONRpcClient.Exception.CODE_ERR_PARSE = 590; +JSONRpcClient.Exception.CODE_ERR_NOMETHOD = 591; +JSONRpcClient.Exception.CODE_ERR_UNMARSHALL = 592; +JSONRpcClient.Exception.CODE_ERR_MARSHALL = 593; + +JSONRpcClient.Exception.prototype = new Error(); + +JSONRpcClient.Exception.prototype.toString = +function JSONRpcClient_Exception_toString(code, msg) +{ + return this.name + ": " + this.message; +}; + + +/* Default top level exception handler */ + +JSONRpcClient.default_ex_handler = +function JSONRpcClient_default_ex_handler(e) { alert(e); }; + + +/* Client settable variables */ + +JSONRpcClient.toplevel_ex_handler = JSONRpcClient.default_ex_handler; +JSONRpcClient.profile_async = false; +JSONRpcClient.max_req_active = 1; +JSONRpcClient.requestId = 1; + + +/* JSONRpcClient implementation */ + +JSONRpcClient.prototype._createMethod = +function JSONRpcClient_createMethod(methodName) +{ + var fn=function() + { + var args = []; + var callback = null; + for(var i=0;i 0) { + var res = JSONRpcClient.async_responses.shift(); + if(res.canceled) continue; + if(res.profile) res.profile.dispatch = new Date(); + try { + res.cb(res.result, res.ex, res.profile); + } catch(e) { + JSONRpcClient.toplevel_ex_handler(e); + } + } + + while(JSONRpcClient.async_requests.length > 0 && + JSONRpcClient.num_req_active < JSONRpcClient.max_req_active) { + var req = JSONRpcClient.async_requests.shift(); + if(req.canceled) continue; + req.client._sendRequest.call(req.client, req); + } +}; + +JSONRpcClient.kick_async = +function JSONRpcClient_kick_async() +{ + if(JSONRpcClient.async_timeout == null) + JSONRpcClient.async_timeout = + setTimeout(JSONRpcClient._async_handler, 0); +}; + +JSONRpcClient.cancelRequest = +function JSONRpcClient_cancelRequest(requestId) +{ + /* If it is in flight then mark it as canceled in the inflight map + and the XMLHttpRequest callback will discard the reply. */ + if(JSONRpcClient.async_inflight[requestId]) { + JSONRpcClient.async_inflight[requestId].canceled = true; + return true; + } + + /* If its not in flight yet then we can just mark it as canceled in + the the request queue and it will get discarded before being sent. */ + for(var i in JSONRpcClient.async_requests) { + if(JSONRpcClient.async_requests[i].requestId == requestId) { + JSONRpcClient.async_requests[i].canceled = true; + return true; + } + } + + /* It may have returned from the network and be waiting for its callback + to be dispatched, so mark it as canceled in the response queue + and the response will get discarded before calling the callback. */ + for(var i in JSONRpcClient.async_responses) { + if(JSONRpcClient.async_responses[i].requestId == requestId) { + JSONRpcClient.async_responses[i].canceled = true; + return true; + } + } + + return false; +}; + +JSONRpcClient.prototype._makeRequest = +function JSONRpcClient_makeRequest(methodName, args, cb) +{ + var req = {}; + req.client = this; + req.requestId = JSONRpcClient.requestId++; + + var obj = {}; + obj.id = req.requestId; + if (this.objectID) + obj.method = ".obj#" + this.objectID + "." + methodName; + else + obj.method = methodName; + obj.params = args; + + if (cb) req.cb = cb; + if (JSONRpcClient.profile_async) + req.profile = { "submit": new Date() }; + req.data = toJSON(obj); + + return req; +}; + +JSONRpcClient.prototype._sendRequest = +function JSONRpcClient_sendRequest(req) +{ + if(req.profile) req.profile.start = new Date(); + + /* Get free http object from the pool */ + var http = JSONRpcClient.poolGetHTTPRequest(); + JSONRpcClient.num_req_active++; + + /* Send the request */ + if (typeof(this.user) == "undefined") { + http.open("POST", this.serverURL, (req.cb != null)); + } else { + http.open("POST", this.serverURL, (req.cb != null), this.user, this.pass); + } + + /* setRequestHeader is missing in Opera 8 Beta */ + try { http.setRequestHeader("Content-type", "text/plain"); } catch(e) {} + + /* Construct call back if we have one */ + if(req.cb) { + var self = this; + http.onreadystatechange = function() { + if(http.readyState == 4) { + http.onreadystatechange = function () {}; + var res = { "cb": req.cb, "result": null, "ex": null}; + if (req.profile) { + res.profile = req.profile; + res.profile.end = new Date(); + } + try { res.result = self._handleResponse(http); } + catch(e) { res.ex = e; } + if(!JSONRpcClient.async_inflight[req.requestId].canceled) + JSONRpcClient.async_responses.push(res); + delete JSONRpcClient.async_inflight[req.requestId]; + JSONRpcClient.kick_async(); + } + }; + } else { + http.onreadystatechange = function() {}; + } + + JSONRpcClient.async_inflight[req.requestId] = req; + + try { + http.send(req.data); + } catch(e) { + JSONRpcClient.poolReturnHTTPRequest(http); + JSONRpcClient.num_req_active--; + throw new JSONRpcClient.Exception + (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed"); + } + + if(!req.cb) return this._handleResponse(http); +}; + +JSONRpcClient.prototype._handleResponse = +function JSONRpcClient_handleResponse(http) +{ + /* Get the charset */ + if(!this.charset) { + this.charset = JSONRpcClient._getCharsetFromHeaders(http); + } + + /* Get request results */ + var status, statusText, data; + try { + status = http.status; + statusText = http.statusText; + data = http.responseText; + } catch(e) { + JSONRpcClient.poolReturnHTTPRequest(http); + JSONRpcClient.num_req_active--; + JSONRpcClient.kick_async(); + throw new JSONRpcClient.Exception + (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed"); + } + + /* Return http object to the pool; */ + JSONRpcClient.poolReturnHTTPRequest(http); + JSONRpcClient.num_req_active--; + + /* Unmarshall the response */ + if(status != 200) { + throw new JSONRpcClient.Exception(status, statusText); + } + var obj; + try { + eval("obj = " + data); + } catch(e) { + throw new JSONRpcClient.Exception(550, "error parsing result"); + } + if(obj.error) + throw new JSONRpcClient.Exception(obj.error.code, obj.error.msg, + obj.error.trace); + var res = obj.result; + + /* Handle CallableProxy */ + if(res && res.objectID && res.JSONRPCType == "CallableReference") + return new JSONRpcClient(this.serverURL, this.user, + this.pass, res.objectID); + + return res; +}; + + +/* XMLHttpRequest wrapper code */ + +/* XMLHttpRequest pool globals */ +JSONRpcClient.http_spare = []; +JSONRpcClient.http_max_spare = 8; + +JSONRpcClient.poolGetHTTPRequest = +function JSONRpcClient_pool_getHTTPRequest() +{ + if(JSONRpcClient.http_spare.length > 0) { + return JSONRpcClient.http_spare.pop(); + } + return JSONRpcClient.getHTTPRequest(); +}; + +JSONRpcClient.poolReturnHTTPRequest = +function JSONRpcClient_poolReturnHTTPRequest(http) +{ + if(JSONRpcClient.http_spare.length >= JSONRpcClient.http_max_spare) + delete http; + else + JSONRpcClient.http_spare.push(http); +}; + +JSONRpcClient.msxmlNames = [ "MSXML2.XMLHTTP.5.0", + "MSXML2.XMLHTTP.4.0", + "MSXML2.XMLHTTP.3.0", + "MSXML2.XMLHTTP", + "Microsoft.XMLHTTP" ]; + +JSONRpcClient.getHTTPRequest = +function JSONRpcClient_getHTTPRequest() +{ + /* Mozilla XMLHttpRequest */ + try { + JSONRpcClient.httpObjectName = "XMLHttpRequest"; + return new XMLHttpRequest(); + } catch(e) {} + + /* Microsoft MSXML ActiveX */ + for (var i=0;i < JSONRpcClient.msxmlNames.length; i++) { + try { + JSONRpcClient.httpObjectName = JSONRpcClient.msxmlNames[i]; + return new ActiveXObject(JSONRpcClient.msxmlNames[i]); + } catch (e) {} + } + + /* None found */ + JSONRpcClient.httpObjectName = null; + throw new JSONRpcClient.Exception(0, "Can't create XMLHttpRequest object"); +}; + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilderTestCase.java new file mode 100644 index 0000000000..a158d3e4e8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilderTestCase.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +import static org.easymock.classextension.EasyMock.createMock; +import static org.easymock.classextension.EasyMock.replay; +import junit.framework.TestCase; + +import org.apache.tuscany.spi.host.ServletHost; + +public class JSONRPCBindingBuilderTestCase extends TestCase { + + public void testSetServletHost() { + JSONRPCBindingBuilder bindingBuilder = new JSONRPCBindingBuilder(); + ServletHost mockServletHost = createMock(ServletHost.class); + replay(mockServletHost); + bindingBuilder.setServletHost(mockServletHost); + assertEquals(mockServletHost, bindingBuilder.getServletHost()); + } + + public void testGetBindingType() { + JSONRPCBindingBuilder bindingBuilder = new JSONRPCBindingBuilder(); + assertEquals(JSONRPCBindingDefinition.class, bindingBuilder.getBindingType()); + } + + @SuppressWarnings("unchecked") + public void testBuildCompositeComponentServiceDefinitionOfJSONRPCBindingDeploymentContext() { +// JSONRPCBindingBuilder bindingBuilder = new JSONRPCBindingBuilder(); +// CompositeComponent mockParent = createMock(CompositeComponent.class); +// replay(mockParent); +// ServiceDefinition mockServiceDefinition = createMock((new ServiceDefinition()).getClass()); +// JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl(); +// try { +// ServiceContract contract = registry.introspect(JSONRPCServiceBinding.class); +// +// expect(mockServiceDefinition.getServiceContract()).andStubReturn(contract); +// expect(mockServiceDefinition.getName()).andReturn("test_service"); +// replay(mockServiceDefinition); +// DeploymentContext mockDeploymentContext = createMock(DeploymentContext.class); +// replay(mockDeploymentContext); +// +// JSONRPCServiceBinding jsonService = +// (JSONRPCServiceBinding) bindingBuilder.build(mockParent, mockServiceDefinition, null, +// mockDeploymentContext); +// assertEquals(JSONRPCServiceBinding.class, jsonService.getClass()); +// +// } catch (InvalidServiceContractException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// fail(e.toString()); +// } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoaderTestCase.java new file mode 100644 index 0000000000..de1df7de97 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoaderTestCase.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +import static org.easymock.classextension.EasyMock.createMock; +import static org.easymock.classextension.EasyMock.replay; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import junit.framework.TestCase; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.model.ModelObject; + +public class JSONRPCBindingLoaderTestCase extends TestCase { + + public void testJSONRPCBindingLoader() { + LoaderRegistry mockRegistry = createMock(LoaderRegistry.class); + replay(mockRegistry); + JSONRPCBindingLoader loader = new JSONRPCBindingLoader(mockRegistry); + assertNotNull(loader); + } + + public void testGetXMLType() { + LoaderRegistry mockRegistry = createMock(LoaderRegistry.class); + replay(mockRegistry); + JSONRPCBindingLoader loader = new JSONRPCBindingLoader(mockRegistry); + assertNotNull(loader); + assertEquals(JSONRPCBindingLoader.BINDING_JSON, loader.getXMLType()); + } + + public void testLoad() { + LoaderRegistry mockRegistry = createMock(LoaderRegistry.class); + replay(mockRegistry); + JSONRPCBindingLoader loader = new JSONRPCBindingLoader(mockRegistry); + assertNotNull(loader); + + CompositeComponent mockParent = createMock(CompositeComponent.class); + replay(mockParent); + ModelObject mockModelObject = createMock(ModelObject.class); + replay(mockModelObject); + XMLStreamReader mockReader = createMock(XMLStreamReader.class); + replay(mockReader); + DeploymentContext mockDeploymentContext = createMock(DeploymentContext.class); + replay(mockDeploymentContext); + + try { + JSONRPCBindingDefinition jsonBinding = loader.load(mockParent, mockModelObject, mockReader, mockDeploymentContext); + assertNotNull(jsonBinding); + } catch (LoaderException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + fail(e.toString()); + } catch (XMLStreamException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + fail(e.toString()); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingTestCase.java new file mode 100644 index 0000000000..945259e801 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingTestCase.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +import junit.framework.TestCase; + +public class JSONRPCBindingTestCase extends TestCase { + + public void testGetURI() { + JSONRPCBindingDefinition jsonBinding = new JSONRPCBindingDefinition(); + jsonBinding.uri = "test_uri"; + assertEquals("test_uri", jsonBinding.getURI()); + } + + public void testSetURI() { + JSONRPCBindingDefinition jsonBinding = new JSONRPCBindingDefinition(); + jsonBinding.setURI("test_uri"); + assertEquals("test_uri", jsonBinding.uri); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServletTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServletTestCase.java new file mode 100644 index 0000000000..112640798d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServletTestCase.java @@ -0,0 +1,186 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.text.ParseException; +import java.util.HashMap; + +import javax.servlet.ServletException; + +import junit.framework.TestCase; + +import org.json.JSONArray; +import org.json.JSONObject; + +import com.meterware.httpunit.GetMethodWebRequest; +import com.meterware.httpunit.PostMethodWebRequest; +import com.meterware.httpunit.WebRequest; +import com.meterware.httpunit.WebResponse; +import com.meterware.servletunit.InvocationContext; +import com.meterware.servletunit.ServletRunner; +import com.meterware.servletunit.ServletUnitClient; + +public class JSONRPCEntryPointServletTestCase extends TestCase implements TestInterface{ + + private static final String MESSAGE = "Testing..1..2..3"; + private static final String SERVICE_PATH = "JsonRpc/Test"; + private static final String SERVICE_URL = "http://localhost/" + SERVICE_PATH; + ServletRunner sr = null; + + + protected void setUp() throws Exception + { + sr = new ServletRunner(); + sr.registerServlet( SERVICE_PATH, JSONRPCEntryPointServlet.class.getName() ); + } + + public void testJSONRPCEntryPointServletContruct() { + JSONRPCEntryPointServlet servlet = new JSONRPCEntryPointServlet("serviceName",TestInterface.class, this); + assertEquals("serviceName", servlet.serviceName); + assertEquals(TestInterface.class, servlet.serviceInterface); + assertEquals(this, servlet.serviceInstance); + } + + public void testGetSmd() throws IOException { + ServletUnitClient sc = sr.newClient(); + WebRequest request = new GetMethodWebRequest( SERVICE_URL ); + request.setParameter( "smd", "" ); + InvocationContext ic = sc.newInvocation( request ); + try { + JSONRPCEntryPointServlet jsonServlet = (JSONRPCEntryPointServlet)ic.getServlet(); + jsonServlet.serviceName = "Test"; + jsonServlet.serviceInterface = TestInterface.class; + jsonServlet.serviceInstance = this; + + ic.service(); + WebResponse response = ic.getServletResponse(); + assertEquals(200, response.getResponseCode()); + JSONObject jsonResp = new JSONObject(response.getText()); + assertEquals("TestInterface", jsonResp.getString("objectName")); + assertEquals("JSON-RPC", jsonResp.getString("serviceType")); + assertEquals(SERVICE_URL, jsonResp.getString("serviceURL")); + JSONArray jsonMethods = jsonResp.getJSONArray("methods"); + assertNotNull(jsonMethods); + assertEquals(2, jsonMethods.length()); + HashMap hashMethods = new HashMap(); + for(int i = 0; i < jsonMethods.length(); i++) + { + JSONObject method = jsonMethods.getJSONObject(i); + assertNotNull(method); + assertNotNull(method.getString("name")); + hashMethods.put(method.getString("name"), method); + } + JSONObject echoMethod = hashMethods.get("echo"); + assertNotNull(echoMethod); + JSONArray echoParameters = echoMethod.getJSONArray("parameters"); + assertNotNull(echoParameters); + assertEquals(1,echoParameters.length()); + assertEquals("param0",echoParameters.getJSONObject(0).getString("name")); + assertEquals("STRING",echoParameters.getJSONObject(0).getString("type")); + JSONObject getMessageMethod = hashMethods.get("getMessage"); + assertNotNull(getMessageMethod); + JSONArray getMessageParameters = getMessageMethod.getJSONArray("parameters"); + assertNotNull(getMessageParameters); + assertEquals(0,getMessageParameters.length()); + + } catch (ServletException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + fail(e.toString()); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + fail(e.toString()); + } + + + } + + public void testZeroParameterMethodCall() throws IOException { + ServletUnitClient sc = sr.newClient(); + + try { + JSONObject jsonRequest = new JSONObject("{ \"method\": \"getMessage\", \"params\": [], \"id\": 1}"); + + WebRequest request = new PostMethodWebRequest( SERVICE_URL, new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")),"application/json"); + InvocationContext ic = sc.newInvocation( request ); + + JSONRPCEntryPointServlet jsonServlet = (JSONRPCEntryPointServlet)ic.getServlet(); + jsonServlet.serviceName = "Test"; + jsonServlet.serviceInterface = TestInterface.class; + jsonServlet.serviceInstance = this; + + ic.service(); + WebResponse response = ic.getServletResponse(); + assertEquals(200, response.getResponseCode()); + JSONObject jsonResp = new JSONObject(response.getText()); + assertEquals(MESSAGE, jsonResp.getString("result")); + } catch (ServletException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + fail(e.toString()); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + fail(e.toString()); + } + + + } + + public void testMalformedJSON() throws IOException { + ServletUnitClient sc = sr.newClient(); + + try { + String badJsonRequest = "{\"no close brace\""; + + WebRequest request = new PostMethodWebRequest( SERVICE_URL, new ByteArrayInputStream(badJsonRequest.getBytes("UTF-8")),"application/json"); + InvocationContext ic = sc.newInvocation( request ); + + JSONRPCEntryPointServlet jsonServlet = (JSONRPCEntryPointServlet)ic.getServlet(); + jsonServlet.serviceName = "Test"; + jsonServlet.serviceInterface = TestInterface.class; + jsonServlet.serviceInstance = this; + + ic.service(); + fail("Expected runtime exception from malformed JSON resquest"); + + } catch (ServletException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + fail(e.toString()); + } catch (RuntimeException e) { + // expected runtime exception from malformed JSON request + assertEquals(true, e.getCause() instanceof ParseException); + } + + + } + + public String echo(String message) { + return message; + } + + public String getMessage() { + return MESSAGE; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCServiceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCServiceTestCase.java new file mode 100644 index 0000000000..cc5efb2221 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCServiceTestCase.java @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +import javax.servlet.Servlet; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.host.ServletHost; +import org.apache.tuscany.spi.wire.WireService; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.model.ServiceContract; + +import static org.easymock.classextension.EasyMock.*; +import org.easymock.EasyMock; + +import junit.framework.TestCase; + +public class JSONRPCServiceTestCase extends TestCase { + private static final String SERVICE_NAME = "test_service_name"; + + @SuppressWarnings({"unchecked"}) + public void testStart() { + CompositeComponent mockParent = createMock(CompositeComponent.class); + replay(mockParent); + WireService mockWireService = createMock(WireService.class); + expect(mockWireService.createProxy(EasyMock.isA(Class.class), EasyMock.isA(InboundWire.class))).andReturn(this); + replay(mockWireService); + ServletHost mockServletHost = createMock(ServletHost.class); + expect(mockServletHost.isMappingRegistered(JSONRPCServiceBinding.SCRIPT_GETTER_SERVICE_MAPPING)).andReturn(false); + mockServletHost.registerMapping(eq("/" + SERVICE_NAME), (Servlet) notNull()); + mockServletHost.registerMapping(eq(JSONRPCServiceBinding.SCRIPT_GETTER_SERVICE_MAPPING), (Servlet) notNull()); + replay(mockServletHost); + + ServiceContract contract = new ServiceContract(Object.class){ + + }; + JSONRPCServiceBinding jsonRpcService = new JSONRPCServiceBinding(SERVICE_NAME, mockParent, mockWireService, mockServletHost ); + InboundWire wire = EasyMock.createNiceMock(InboundWire.class); + EasyMock.expect(wire.getServiceContract()).andReturn(contract); + EasyMock.replay(wire); + jsonRpcService.setInboundWire(wire); + jsonRpcService.start(); + } + + @SuppressWarnings({"unchecked"}) + public void testStop() { + CompositeComponent mockParent = createMock(CompositeComponent.class); + replay(mockParent); + WireService mockWireService = createMock(WireService.class); + expect(mockWireService.createProxy(EasyMock.isA(Class.class), EasyMock.isA(InboundWire.class))).andReturn(this); + replay(mockWireService); + ServletHost mockServletHost = createMock(ServletHost.class); + expect(mockServletHost.isMappingRegistered(JSONRPCServiceBinding.SCRIPT_GETTER_SERVICE_MAPPING)).andReturn(false); + mockServletHost.registerMapping(eq("/" + SERVICE_NAME), (Servlet) notNull()); + mockServletHost.registerMapping(eq(JSONRPCServiceBinding.SCRIPT_GETTER_SERVICE_MAPPING), (Servlet) notNull()); + expect(mockServletHost.unregisterMapping(eq("/" + SERVICE_NAME))).andReturn(null); + expect(mockServletHost.unregisterMapping(eq(JSONRPCServiceBinding.SCRIPT_GETTER_SERVICE_MAPPING))).andReturn(null); + replay(mockServletHost); + + ServiceContract contract = new ServiceContract(Object.class){ + + }; + JSONRPCServiceBinding jsonRpcService = new JSONRPCServiceBinding(SERVICE_NAME, mockParent, mockWireService, mockServletHost ); + InboundWire wire = EasyMock.createNiceMock(InboundWire.class); + EasyMock.expect(wire.getServiceContract()).andReturn(contract); + EasyMock.replay(wire); + jsonRpcService.setInboundWire(wire); + jsonRpcService.start(); + jsonRpcService.stop(); + } + + public void testJSONRPCService() { + CompositeComponent mockParent = createMock(CompositeComponent.class); + replay(mockParent); + WireService mockWireService = createMock(WireService.class); + replay(mockWireService); + ServletHost mockServletHost = createMock(ServletHost.class); + replay(mockServletHost); + + JSONRPCServiceBinding jsonRpcService = new JSONRPCServiceBinding(SERVICE_NAME, mockParent, mockWireService, mockServletHost ); + assertNotNull(jsonRpcService); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServletTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServletTestCase.java new file mode 100644 index 0000000000..da7d52d21f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServletTestCase.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +import java.io.IOException; + +import junit.framework.TestCase; + +import org.xml.sax.SAXException; + +import com.meterware.httpunit.GetMethodWebRequest; +import com.meterware.httpunit.WebRequest; +import com.meterware.httpunit.WebResponse; +import com.meterware.servletunit.ServletRunner; +import com.meterware.servletunit.ServletUnitClient; + +public class ScriptGetterServletTestCase extends TestCase { + + private static final String SERVICE_PATH = "JsonRpc/ScriptGetterTest"; + private static final String SERVICE_URL = "http://localhost/" + SERVICE_PATH; + ServletRunner sr = null; + + + protected void setUp() throws Exception { + sr = new ServletRunner(); + sr.registerServlet( SERVICE_PATH, ScriptGetterServlet.class.getName() ); + } + + public void testGetScript() throws IOException { + ServletUnitClient sc = sr.newClient(); + WebRequest request = new GetMethodWebRequest( SERVICE_URL ); + try { + WebResponse response = sc.getResponse(request); + assertEquals(200, response.getResponseCode()); + } catch (SAXException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + fail(e1.toString()); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/TestInterface.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/TestInterface.java new file mode 100644 index 0000000000..ac39700dda --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/TestInterface.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc; + +public interface TestInterface { + String getMessage(); + String echo(String message); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/util/JavaToSmdTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/util/JavaToSmdTestCase.java new file mode 100644 index 0000000000..f61866eea5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/util/JavaToSmdTestCase.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jsonrpc.util; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import junit.framework.TestCase; + +public class JavaToSmdTestCase extends TestCase { + + public void testInstantiate() { + // this test is only really here to get 100% test coverage + JavaToSmd test = new JavaToSmd(); + assertNotNull(test); + } + + public void testInterfaceToSmd() { + String serviceUrl = "/testServiceUrl"; + String smd = JavaToSmd.interfaceToSmd(java.util.Observer.class,serviceUrl); + assertNotNull(smd); + JSONObject json = new JSONObject(smd); + assertNotNull(json); + assertEquals(".1", json.getString("SMDVersion")); + assertEquals("Observer", json.getString("objectName")); + assertEquals("JSON-RPC", json.getString("serviceType")); + assertEquals(serviceUrl, json.getString("serviceURL")); + JSONArray methodsArray = json.getJSONArray("methods"); + assertNotNull(methodsArray); + assertEquals(1, methodsArray.length()); + JSONObject methodJson = methodsArray.getJSONObject(0); + assertNotNull(methodJson); + assertEquals("update", methodJson.getString("name")); + JSONArray parametersArray = methodJson.getJSONArray("parameters"); + assertNotNull(parametersArray); + assertEquals(2, parametersArray.length()); + JSONObject param0Json = parametersArray.getJSONObject(0); + assertNotNull(param0Json); + assertEquals("param0", param0Json.getString("name")); + assertEquals("STRING", param0Json.getString("type")); + JSONObject param1Json = parametersArray.getJSONObject(1); + assertNotNull(param1Json); + assertEquals("param1", param1Json.getString("name")); + assertEquals("STRING", param1Json.getString("type")); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/pom.xml new file mode 100644 index 0000000000..51a15db751 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/pom.xml @@ -0,0 +1,66 @@ + + + + + + org.apache.tuscany.sca.extensions + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.jsonrpc + parent + pom + Apache Tuscany SCA Extensions for JSONRPC + + + binding + samples + + + + + + + com.metaparadigm + json-rpc + 1.0 + compile + + + + net.sf.json-lib + json-lib + 0.8 + test + + + + httpunit + httpunit + 1.6.1 + test + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/.ruleset new file mode 100644 index 0000000000..ac8671859d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/.ruleset @@ -0,0 +1,190 @@ + + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/build.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/build.xml new file mode 100644 index 0000000000..76a8171a3b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/build.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/pom.xml new file mode 100644 index 0000000000..876ba3ea85 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/pom.xml @@ -0,0 +1,116 @@ + + + + + org.apache.tuscany.sca.extensions.jsonrpc.samples + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + sample-helloworldjsonrpc + war + Tuscany HelloWorld JSON-RPC Sample + A sample HelloWorld Web application using JSON-RPC + + + + org.osoa + sca-api-r1.0 + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + sample-helloworldjsonrpc + + + org.apache.maven.plugins + maven-antrun-plugin + + + install-dojo + validate + + run + + + + + + + + + + + copy-dojo-files + generate-resources + + run + + + + + + + + + + + + clean-dojo-files + clean + + run + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/java/helloworldjsonrpc/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/java/helloworldjsonrpc/HelloWorldService.java new file mode 100644 index 0000000000..38258ac83a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/java/helloworldjsonrpc/HelloWorldService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworldjsonrpc; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorldService { + + String getGreetings(String name); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..0372ded214 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworldjsonrpc; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service component. + */ +@Service(HelloWorldService.class) +public class HelloWorldServiceImpl implements HelloWorldService { + + /* + * @see org.apache.tuscany.samples.helloworld.HelloWorldServiceComponent#getGreetings() + */ + public String getGreetings(String name) { + return "jsonrpcHello " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/HelloWorldJSONRPC.html b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/HelloWorldJSONRPC.html new file mode 100644 index 0000000000..bd082525bb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/HelloWorldJSONRPC.html @@ -0,0 +1,136 @@ + + + + Tuscany JSON-RPC HelloWorld Example + + + + + + + + + + + + + + + + +

Tuscany JSON-RPC HelloWorld Examples

+ + + + + + + + + + + + + + + +
Non-Dojo Example
+ This example uses the JavaScript served from + services/SCA/scripts + to make JSON-RPC requests to the service located at + services/HelloWorldJSONService +
RequestResponse
+

+ Name please:     + + +

+ +
+
None Yet.
+
+ +
+ + + + + + + + + + + + + + + + + + +
Dojo Example
+

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

+

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

+
RequestResponse
+
helloWorldService.getGreetings("Dojo").addCallback(contentCallBack);

+
+
None Yet.
+
+
Dojo Debug:
+
+ + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/WEB-INF/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/WEB-INF/default.scdl new file mode 100644 index 0000000000..7344783958 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/WEB-INF/default.scdl @@ -0,0 +1,32 @@ + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..f103b8e456 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,50 @@ + + + + + + Tuscany sample HelloWorld JSON-RPC + + + HelloWorldJSONRPC.html + + + + tuscany.online + false + + + + org.apache.tuscany.runtime.webapp.TuscanyContextListener + + + + TuscanyServlet + Tuscany Servlet + org.apache.tuscany.runtime.webapp.TuscanyServlet + + + + TuscanyServlet + /services/* + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/style.css b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/style.css new file mode 100644 index 0000000000..eb246aaf14 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/style.css @@ -0,0 +1,4 @@ +* { font-family: arial; } + +table, th, td { border: 2px solid blue; border-collapse: collapse; } +th { color: white; background-color: blue; } diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/pom.xml new file mode 100644 index 0000000000..c61621c441 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/pom.xml @@ -0,0 +1,96 @@ + + + + + + org.apache.tuscany.sca.extensions.jsonrpc + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.jsonrpc.samples + parent + pom + Tuscany Samples for the JSONRPC extension + + + + + apache.snapshots + Apache Snapshot Repository + http://people.apache.org/repo/m2-snapshot-repository + + false + + + true + + + + apache.incubator + Apache Incubator Repository + http://people.apache.org/repo/m2-incubating-repository/ + + true + + + false + + + + + + helloworld + + + + + + org.codehaus.mojo + dependency-maven-plugin + + + + org.apache.tuscany.distribution.sca + standalone + ${scaImplVersion} + bin + zip + + + ${project.build.directory}/distribution + + + + + + + + + org.osoa + sca-api-r1.0 + 0.1-integration-incubating-SNAPSHOT + compile + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/pom.xml new file mode 100644 index 0000000000..55e92af872 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/pom.xml @@ -0,0 +1,159 @@ + + + + + org.apache.tuscany.sca + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions + parent + 0.1-integration-incubating-SNAPSHOT + pom + Apache Tuscany SCA Extensions + + + 0.1-integration-incubating-SNAPSHOT + 0.1-integration-incubating-SNAPSHOT + 0.1-integration-incubating-SNAPSHOT + 1.0 + 0.1-integration-incubating-SNAPSHOT + 1.0-incubator-SNAPSHOT + + + + + + apache.snapshots + Apache Snapshot Repository + http://people.apache.org/repo/m2-snapshot-repository + + false + + + true + + + + apache.incubator + Apache Incubator Repository + http://people.apache.org/repo/m2-incubating-repository/ + + true + + + false + + + + + + + + stable + + true + + + axis2 + jms + + + + + integration + + axis2 + script + jms + jsonrpc + + + + + unstable + + axis2 + script + jms + jsonrpc + + + + + + + + + + org.osoa + sca-api-r1.0 + 0.1-integration-incubating-SNAPSHOT + compile + + + + junit + junit + 4.2 + test + + + + org.easymock + easymock + 2.2 + test + + + + org.easymock + easymockclassextension + 2.2 + test + + + + org.apache.tuscany.sca.kernel + tuscany-api + ${scaKernelVersion} + compile + + + + org.apache.tuscany.sca.kernel + tuscany-spi + ${scaKernelVersion} + compile + + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + ${scaKernelVersion} + compile + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/.ruleset new file mode 100644 index 0000000000..a1547fea92 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/.ruleset @@ -0,0 +1,190 @@ + + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/LICENSE.txt new file mode 100755 index 0000000000..0084319535 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, serviceDefinition marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/NOTICE.txt new file mode 100644 index 0000000000..ecc68a9614 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/pom.xml new file mode 100644 index 0000000000..a9930d5315 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/pom.xml @@ -0,0 +1,96 @@ + + + + + + org.apache.tuscany.sca.extensions + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-bsf + Apache Tuscany Script Container + Apache Tuscany Script Container using BSF + + + + + org.apache.tuscany.sca.kernel + tuscany-spi + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + bsf + bsf + 2.4.0 + compile + + + + commons-logging + commons-logging + 1.1 + runtime + + + + asm + asm + 2.2 + compile + + + + org.easymock + easymock + + + + org.easymock + easymockclassextension + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java new file mode 100644 index 0000000000..f79325170a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java @@ -0,0 +1,135 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import static org.objectweb.asm.Opcodes.ACC_ABSTRACT; +import static org.objectweb.asm.Opcodes.ACC_INTERFACE; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.V1_5; + +import java.util.Arrays; + +import org.apache.tuscany.spi.ObjectCreationException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.TargetResolutionException; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.extension.AtomicComponentExtension; +import org.apache.tuscany.spi.extension.ExecutionMonitor; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.services.work.WorkScheduler; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.OutboundWire; +import org.apache.tuscany.spi.wire.TargetInvoker; +import org.apache.tuscany.spi.wire.WireObjectFactory; +import org.apache.tuscany.spi.wire.WireService; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Type; + +/** + * A component implementation for script languages. + */ +public class ScriptComponent extends AtomicComponentExtension { + + private ScriptInstanceFactory factory; + + public ScriptComponent(String name, + CompositeComponent parent, + WireService wireService, + WorkContext workContext, + WorkScheduler workScheduler, + ExecutionMonitor monitor, + int initLevel, + ScriptInstanceFactory factory, + Scope scope) { + super(name, parent, wireService, workContext, workScheduler, monitor, initLevel); + this.factory = factory; + this.scope = scope; + setPassByReferenceMethods(Arrays.asList(new String[]{})); + } + + public Object createInstance() throws ObjectCreationException { + return factory.getInstance(); + } + + public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) { + return new ScriptTargetInvoker(operation.getName(), this); + } + + @SuppressWarnings({"unchecked"}) + protected void onReferenceWire(OutboundWire wire) { + Class clazz = wire.getServiceContract().getInterfaceClass(); + if (clazz == null) { + clazz = createInterfaceClass(wire.getServiceContract()); + } + factory.addContextObjectFactory(wire.getReferenceName(), clazz, new WireObjectFactory(clazz, wire, wireService)); + } + + public Object getTargetInstance() throws TargetResolutionException { + return scopeContainer.getInstance(this); + } + + /** + * Create an Java interface class for the WSDL ServiceContract + * TODO: this should probably be moved to wsdl idl module + */ + private Class createInterfaceClass(ServiceContract serviceContract) { + ClassWriter cw = new ClassWriter(false); + + // Generate the interface + String interfaceName = serviceContract.getInterfaceName(); + cw.visit(V1_5, + ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE, + interfaceName, + null, + "java/lang/Object", + new String[0]); + + // Generate methods from the WSDL operations + for (Object o : serviceContract.getOperations().values()) { + Operation operation = (Operation)o; + String inputType = Type.getDescriptor(Object.class); + String outputType = Type.getDescriptor(Object.class); + cw.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, + operation.getName(), + "(" + inputType + ")" + outputType, + null, + null).visitEnd(); + } + + // Generate the bytecodes + cw.visitEnd(); + byte[] bytes = cw.toByteArray(); + + Class interfaceClass = new GeneratedClassLoader().defineClass(bytes); + + return interfaceClass; + } + + private class GeneratedClassLoader extends ClassLoader { + public Class defineClass(byte[] byteArray) { + try { + return defineClass(null, byteArray, 0, byteArray.length); + } catch (Throwable e) { + return null; + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java new file mode 100644 index 0000000000..fee815680f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java @@ -0,0 +1,97 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import org.apache.tuscany.spi.builder.BuilderConfigException; +import org.apache.tuscany.spi.component.Component; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.ScopeContainer; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.ComponentBuilderExtension; +import org.apache.tuscany.spi.idl.java.JavaServiceContract; +import org.apache.tuscany.spi.model.ComponentDefinition; +import org.apache.tuscany.spi.model.PropertyValue; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.model.ServiceDefinition; + +/** + * Extension point for creating {@link ScriptComponent}s from an assembly configuration + * + * @version $Rev$ $Date$ + */ +public class ScriptComponentBuilder extends ComponentBuilderExtension { + + public ScriptComponentBuilder() { + } + + protected Class getImplementationType() { + return ScriptImplementation.class; + } + + public Component build(CompositeComponent parent, ComponentDefinition componentDefinition, + DeploymentContext deploymentContext) throws BuilderConfigException { + + ScriptImplementation implementation = componentDefinition.getImplementation(); + + for (ServiceDefinition service : implementation.getComponentType().getServices().values()) { + // if its not a Java interface assume WSDL and want XML databinding + ServiceContract contract = service.getServiceContract(); + if (!(contract instanceof JavaServiceContract)) { + service.getServiceContract().setDataBinding("org.mozilla.javascript.xmlimpl.XML"); + } + } + + ScriptInstanceFactory instanceFactory = createInstanceFactory(componentDefinition, implementation); + + String name = componentDefinition.getName(); + Scope scope = getScope(deploymentContext, implementation.getComponentType()); + + return new ScriptComponent(name, parent, wireService, workContext, workScheduler, null, 0, instanceFactory, scope); + } + + private ScriptInstanceFactory createInstanceFactory(ComponentDefinition componentDefinition, ScriptImplementation implementation) { + + String className = implementation.getClassName(); + String scriptSource = implementation.getScriptSource(); + String scriptName = implementation.getScriptName(); + ClassLoader cl = implementation.getClassLoader(); + + ScriptInstanceFactory instanceFactory = new ScriptInstanceFactory(scriptName, className, scriptSource, cl); + + // add the properties for the component + for (PropertyValue propertyValue : componentDefinition.getPropertyValues().values()) { + instanceFactory.addContextObjectFactory(propertyValue.getName(), propertyValue.getValueFactory()); + } + + return instanceFactory; + } + + protected Scope getScope(DeploymentContext deploymentContext, ScriptComponentType componentType) { + ScopeContainer scopeContainer; + Scope scope = componentType.getImplementationScope(); + if (Scope.COMPOSITE == scope) { + scopeContainer = deploymentContext.getCompositeScope(); + } else { + scopeContainer = scopeRegistry.getScopeContainer(scope); + } + return scopeContainer.getScope(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java new file mode 100644 index 0000000000..70ec3e88c7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.model.ComponentType; +import org.apache.tuscany.spi.model.Property; +import org.apache.tuscany.spi.model.ReferenceDefinition; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.model.ServiceDefinition; + +/** + * A componentType for script components TODO: need lifecycle methods + * init/destroy + */ +public class ScriptComponentType extends ComponentType> { + + public ScriptComponentType() { + this.implementationScope = Scope.COMPOSITE; + } + + @Override + public Property getProperty(String name) { + Property p = super.getProperty(name); + if (p == null) { + p = new Property(name, new QName("http://www.w3.org/2001/XMLSchema", "any"), null); + } + return p; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentTypeLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentTypeLoader.java new file mode 100644 index 0000000000..5c3e420b29 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentTypeLoader.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import java.net.URL; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.MissingSideFileException; +import org.apache.tuscany.spi.model.ComponentType; + +/** + * ComponentType loader for script components + */ +public class ScriptComponentTypeLoader extends ComponentTypeLoaderExtension { + + public ScriptComponentTypeLoader() { + } + + @Override + protected Class getImplementationClass() { + return ScriptImplementation.class; + } + + public void load(CompositeComponent parent, + ScriptImplementation implementation, + DeploymentContext deploymentContext) throws LoaderException { + String sideFile = getSideFileName(implementation.getResourceName()); + URL resource = implementation.getClassLoader().getResource(sideFile); + ScriptComponentType componentType; + if (resource == null) { + throw new MissingSideFileException("Component type side file not found", sideFile); + // TODO: or else implement introspection + } else { + componentType = loadFromSidefile(parent, resource, deploymentContext); + } + implementation.setComponentType(componentType); + } + + @SuppressWarnings("unchecked") + protected ScriptComponentType loadFromSidefile(CompositeComponent parent, + URL url, + DeploymentContext deploymentContext) + throws LoaderException { + ScriptComponentType scriptComponentType = new ScriptComponentType(); + return (ScriptComponentType) loaderRegistry + .load(parent, scriptComponentType, url, ComponentType.class, deploymentContext); + } + + protected String getSideFileName(String resourceName) { + int lastDot = resourceName.lastIndexOf('.'); + if (lastDot != -1) { + resourceName = resourceName.substring(0, lastDot); + } + return resourceName + ".componentType"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementation.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementation.java new file mode 100644 index 0000000000..8b54944cf4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementation.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import org.apache.tuscany.spi.model.AtomicImplementation; + +/** + * Model object for a script implementation. + */ +public class ScriptImplementation extends AtomicImplementation { + + private String resourceName; + private String className; + private String scriptSource; + private String scriptName; + private ClassLoader classLoader; + + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public String getScriptSource() { + return scriptSource; + } + + public void setScriptSource(String scriptSource) { + this.scriptSource = scriptSource; + } + + public String getScriptName() { + return scriptName; + } + + public void setScriptName(String scriptName) { + this.scriptName = scriptName; + } + + public ClassLoader getClassLoader() { + return classLoader; + } + + public void setClassLoader(ClassLoader classLoader) { + this.classLoader = classLoader; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationJavaScriptLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationJavaScriptLoader.java new file mode 100644 index 0000000000..1e48309dc6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationJavaScriptLoader.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.container.script; + +import static org.osoa.sca.Constants.SCA_NS; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.osoa.sca.annotations.Constructor; + +public class ScriptImplementationJavaScriptLoader extends ScriptImplementationLoader { + + private static final QName IMPLEMENTATION_JS = new QName(SCA_NS, "implementation.js"); + + @Constructor({"registry"}) + public ScriptImplementationJavaScriptLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + public QName getXMLType() { + return IMPLEMENTATION_JS; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationLoader.java new file mode 100644 index 0000000000..2751011443 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationLoader.java @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import static org.osoa.sca.Constants.SCA_NS; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.loader.LoaderUtil; +import org.apache.tuscany.spi.loader.MissingResourceException; +import org.apache.tuscany.spi.model.ModelObject; +import org.osoa.sca.annotations.Constructor; + +/** + * Loader for handling implementation.script elements. + *

+ * + * + * @version $Rev$ $Date$ + */ +public class ScriptImplementationLoader extends LoaderExtension { + + private static final QName IMPLEMENTATION_SCRIPT = new QName(SCA_NS, "implementation.script"); + + @Constructor({"registry"}) + public ScriptImplementationLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + public QName getXMLType() { + return IMPLEMENTATION_SCRIPT; + } + + public ScriptImplementation load(CompositeComponent parent, ModelObject mo, XMLStreamReader reader, + DeploymentContext deploymentContext) throws XMLStreamException, LoaderException { + String scriptName = reader.getAttributeValue(null, "script"); + if (scriptName == null) { + throw new MissingResourceException("implementation element has no 'script' attribute"); + } + + String className = reader.getAttributeValue(null, "class"); + + LoaderUtil.skipToEndElement(reader); + + ClassLoader cl = deploymentContext.getClassLoader(); + String scriptSource = loadSource(cl, scriptName); + + ScriptImplementation implementation = new ScriptImplementation(); + implementation.setResourceName(scriptName); + implementation.setScriptSource(scriptSource); + implementation.setClassName(className); + implementation.setScriptName(scriptName); + implementation.setClassLoader(cl); + + registry.loadComponentType(parent, implementation, deploymentContext); + + return implementation; + } + + protected String loadSource(ClassLoader cl, String resource) throws LoaderException { + URL url = cl.getResource(resource); + if (url == null) { + throw new MissingResourceException(resource); + } + InputStream is; + try { + is = url.openStream(); + } catch (IOException e) { + throw new MissingResourceException(resource, e); + } + try { + Reader reader = new InputStreamReader(is, "UTF-8"); + char[] buffer = new char[1024]; + StringBuilder source = new StringBuilder(); + int count; + while ((count = reader.read(buffer)) > 0) { + source.append(buffer, 0, count); + } + return source.toString(); + } catch (IOException e) { + throw new LoaderException(resource, e); + } finally { + try { + is.close(); + } catch (IOException e) { + // ignore + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationPythonLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationPythonLoader.java new file mode 100644 index 0000000000..9836794e3a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationPythonLoader.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.container.script; + +import static org.osoa.sca.Constants.SCA_NS; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.loader.LoaderUtil; +import org.apache.tuscany.spi.loader.MissingResourceException; +import org.apache.tuscany.spi.model.ModelObject; +import org.osoa.sca.annotations.Constructor; + +public class ScriptImplementationPythonLoader extends ScriptImplementationLoader { + + private static final QName IMPLEMENTATION_PYTHON = new QName(SCA_NS, "implementation.python"); + + @Constructor({"registry"}) + public ScriptImplementationPythonLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + public QName getXMLType() { + return IMPLEMENTATION_PYTHON; + } + + @Override + public ScriptImplementation load(CompositeComponent parent, ModelObject mo, XMLStreamReader reader, + DeploymentContext deploymentContext) throws XMLStreamException, LoaderException { + String scriptName = reader.getAttributeValue(null, "module"); + if (scriptName == null) { + throw new MissingResourceException("implementation element has no 'module' attribute"); + } + + String className = reader.getAttributeValue(null, "class"); + + LoaderUtil.skipToEndElement(reader); + + ClassLoader cl = deploymentContext.getClassLoader(); + String scriptSource = loadSource(cl, scriptName); + + ScriptImplementation implementation = new ScriptImplementation(); + implementation.setResourceName(scriptName); + implementation.setScriptSource(scriptSource); + implementation.setClassName(className); + implementation.setScriptName(scriptName); + implementation.setClassLoader(cl); + + registry.loadComponentType(parent, implementation, deploymentContext); + + return implementation; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationRubyLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationRubyLoader.java new file mode 100644 index 0000000000..42dab55246 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationRubyLoader.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.container.script; + +import static org.osoa.sca.Constants.SCA_NS; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.osoa.sca.annotations.Constructor; + +public class ScriptImplementationRubyLoader extends ScriptImplementationLoader { + + private static final QName IMPLEMENTATION_RUBY = new QName(SCA_NS, "implementation.ruby"); + + @Constructor({"registry"}) + public ScriptImplementationRubyLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + public QName getXMLType() { + return IMPLEMENTATION_RUBY; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstance.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstance.java new file mode 100644 index 0000000000..988d2a96c2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstance.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.bsf.BSFEngine; +import org.apache.bsf.BSFException; + +/** + * An invokable instance of a script + * + * Basically just a wrapper around a BSF engine with an optional script class object. + */ +public class ScriptInstance { + + protected BSFEngine bsfEngine; + protected Object clazz; + + public ScriptInstance(BSFEngine bsfEngine, Object clazz) { + this.bsfEngine = bsfEngine; + this.clazz = clazz; + } + + public Object invokeTarget(String operationName, Object[] args) throws InvocationTargetException { + try { + return bsfEngine.call(clazz, operationName, args); + } catch (BSFException e) { + throw new InvocationTargetException(e.getTargetException() != null ? e.getTargetException() : e); + } catch (Exception e) { + throw new InvocationTargetException(e); + } + } +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java new file mode 100644 index 0000000000..201af2265a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java @@ -0,0 +1,151 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.spi.ObjectCreationException; +import org.apache.tuscany.spi.ObjectFactory; + +import org.apache.bsf.BSFEngine; +import org.apache.bsf.BSFException; +import org.apache.bsf.BSFManager; + +/** + * ScriptFactory creates ScriptInstances for a script + */ +public class ScriptInstanceFactory implements ObjectFactory { + protected String resourceName; + protected ClassLoader classLoader; + private String className; + private String scriptSource; + private Map contextObjects; + private Map contextTypes; + + public ScriptInstanceFactory(String resourceName, String className, String scriptSource, ClassLoader classLoader) { + this.resourceName = resourceName; + this.classLoader = classLoader; + this.className = className; + this.scriptSource = scriptSource; + this.contextObjects = new HashMap(); + this.contextTypes = new HashMap(); + } + + /** + * Create a new invokeable instance of the script

objects to add to + * scope of the script instance + * + * @return a RhinoScriptInstance + */ + // public ScriptInstanceImpl createInstance(List> serviceBindings, + // Map context) { + public ScriptInstance getInstance() throws ObjectCreationException { + try { + + // TODO: this uses a new manager and recompiles the scrip each time, + // may be able to optimize + // but need to be careful about instance scoping + + BSFManager bsfManager = new BSFManager(); + bsfManager.setClassLoader(BSFManager.class.getClassLoader()); + + // TODO: hack to get Ruby working with the standalone launcher + Thread.currentThread().setContextClassLoader(BSFManager.class.getClassLoader()); + + // register any context objects (SCA properties and references) + for (Map.Entry entry : contextObjects.entrySet()) { + Object value = entry.getValue().getInstance(); + Class type = contextTypes.get(entry.getKey()); + if (type == null) { + type = value.getClass(); + } + bsfManager.declareBean(entry.getKey(), value, type); + } + + String scriptLanguage = BSFManager.getLangFromFilename(resourceName); + BSFEngine bsfEngine = bsfManager.loadScriptingEngine(scriptLanguage); + bsfEngine.exec(resourceName, 0, 0, scriptSource); + + // register any context objects (SCA properties and references) + for (Map.Entry entry : contextObjects.entrySet()) { + Object value = entry.getValue().getInstance(); + Class type = contextTypes.get(entry.getKey()); + if (type == null) { + type = value.getClass(); + } + // TODO: Hack to bypass bug in BSF javascript engine + if (!("javascript".equals(scriptLanguage)) || (value instanceof Number) || (value instanceof String) || (value instanceof Boolean)) { + bsfManager.declareBean(entry.getKey(), value, type); + } + } + + // if there's a className then get the class object + Object clazz = null; + if (className != null) { + // special case for Ruby which requires a .new call + if ("ruby".equals(scriptLanguage)) { + clazz = bsfEngine.eval(null, 1, 1, className + ".new"); + } else { + clazz = bsfEngine.call(null, className, null); + } + } + + return new ScriptInstance(bsfEngine, clazz); + + } catch (BSFException e) { + if (e.getTargetException() != null) { + throw new ObjectCreationException(e.getTargetException()); + } + throw new ObjectCreationException(e.getTargetException()); + } + } + + public String getResourceName() { + return resourceName; + } + + public ClassLoader getClassLoader() { + return classLoader; + } + + protected Map getResponseClasses(List services) { + Map responseClasses = new HashMap(); + if (services != null) { + for (Class s : services) { + for (Method m : s.getMethods()) { + responseClasses.put(m.getName(), m.getReturnType()); + } + } + } + return responseClasses; + } + + public void addContextObjectFactory(String name, ObjectFactory factory) { + contextObjects.put(name, factory); + } + + public void addContextObjectFactory(String name, Class type, ObjectFactory factory) { + contextObjects.put(name, factory); + contextTypes.put(name, type); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java new file mode 100644 index 0000000000..21b84bb83b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.tuscany.spi.component.TargetException; +import org.apache.tuscany.spi.extension.TargetInvokerExtension; + +/** + * TargetInvoker implementation that calls a function on a ScriptInstanceImpl + * + * @version $Rev$ $Dev$ + */ +public class ScriptTargetInvoker extends TargetInvokerExtension { + + protected ScriptComponent component; + protected String functionName; + + public ScriptTargetInvoker(String functionName, ScriptComponent component) { + super(null, null, null); + this.functionName = functionName; + this.component = component; + } + + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + ScriptInstance target; + try { + target = (ScriptInstance) component.getTargetInstance(); + } catch (TargetException e) { + throw new InvocationTargetException(e); + } + try { + return target.invokeTarget(functionName, (Object[]) payload); + } catch (Exception e) { + throw new InvocationTargetException(e); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..149fa2696c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/extension.composite new file mode 100644 index 0000000000..1795216154 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/extension.composite @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/script.system.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/script.system.scdl new file mode 100644 index 0000000000..f08d7d0fc0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/script.system.scdl @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentBuilderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentBuilderTestCase.java new file mode 100644 index 0000000000..c8f3240272 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentBuilderTestCase.java @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import org.apache.tuscany.spi.ObjectFactory; +import org.apache.tuscany.spi.component.Component; +import org.apache.tuscany.spi.component.ScopeContainer; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.idl.java.JavaServiceContract; +import org.apache.tuscany.spi.model.ComponentDefinition; +import org.apache.tuscany.spi.model.PropertyValue; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.model.ServiceDefinition; + +import junit.framework.TestCase; +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.replay; +import org.easymock.IAnswer; + +public class ScriptComponentBuilderTestCase extends TestCase { + + public void testGetImplementationType() { + ScriptComponentBuilder builder = new ScriptComponentBuilder(); + assertEquals(ScriptImplementation.class, builder.getImplementationType()); + } + + @SuppressWarnings("unchecked") + public void testBuild() throws Exception { + ScriptComponentBuilder builder = new ScriptComponentBuilder(); + DeploymentContext deploymentContext = createMock(DeploymentContext.class); + final ScopeContainer scopeContainer = createMock(ScopeContainer.class); + expect(scopeContainer.getScope()).andStubAnswer(new IAnswer() { + public Object answer() throws Throwable { + return Scope.COMPOSITE; + } + }); + expect(deploymentContext.getCompositeScope()).andStubAnswer(new IAnswer() { + public Object answer() throws Throwable { + return scopeContainer; + } + }); + replay(deploymentContext); + ComponentDefinition impl = + new ComponentDefinition(new ScriptImplementation()); + ScriptComponentType componentType = new ScriptComponentType(); + ServiceDefinition service = new ServiceDefinition(); + ServiceContract serviceContract = new JavaServiceContract(); + service.setServiceContract(serviceContract); + componentType.add(service); + impl.getImplementation().setComponentType(componentType); + + PropertyValue pv = new PropertyValue("foo", "", ""); + ObjectFactory pvFactory = (ObjectFactory) createMock(ObjectFactory.class); + expect(pvFactory.getInstance()).andStubAnswer(new IAnswer() { + public Object answer() throws Throwable { + return null; + } + }); + replay(pvFactory); + pv.setValueFactory(pvFactory); + impl.add(pv); + + Component component = builder.build(null, impl, deploymentContext); + assertNotNull(component); + } + + @SuppressWarnings("unchecked") + public void testBuildCompositeScope() throws Exception { + ScriptComponentBuilder builder = new ScriptComponentBuilder(); + DeploymentContext deploymentContext = createMock(DeploymentContext.class); + final ScopeContainer scopeContainer = createMock(ScopeContainer.class); + expect(scopeContainer.getScope()).andStubAnswer(new IAnswer() { + public Object answer() throws Throwable { + return Scope.COMPOSITE; + } + }); + expect(deploymentContext.getCompositeScope()).andStubAnswer(new IAnswer() { + public Object answer() throws Throwable { + return scopeContainer; + } + }); + replay(deploymentContext); + ComponentDefinition impl = + new ComponentDefinition(new ScriptImplementation()); + ScriptComponentType componentType = new ScriptComponentType(); + ServiceDefinition service = new ServiceDefinition(); + ServiceContract serviceContract = new JavaServiceContract(); + service.setServiceContract(serviceContract); + componentType.add(service); + impl.getImplementation().setComponentType(componentType); + Component component = builder.build(null, impl, deploymentContext); + assertNotNull(component); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java new file mode 100644 index 0000000000..00bde59069 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION; + +import java.lang.reflect.Type; +import java.util.List; + +import junit.framework.TestCase; + +import org.apache.tuscany.spi.component.ScopeContainer; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.TargetInvoker; +import org.easymock.EasyMock; + +public class ScriptComponentTestCase extends TestCase { + + private ScopeContainer container; + + @SuppressWarnings("unchecked") + public void testCreateTargetInvoker() { + ScriptComponent component = new ScriptComponent("foo", null, null, null, null,null,0,null, container.getScope()); + Operation operation = new Operation("hashCode", null, null, null, false, null, NO_CONVERSATION); + operation.setServiceContract(new Contract(List.class)); + TargetInvoker invoker = component.createTargetInvoker("hashCode", operation, null); + assertNotNull(invoker); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + container = EasyMock.createMock(ScopeContainer.class); + EasyMock.expect(container.getScope()).andReturn(Scope.COMPOSITE); + EasyMock.replay(container); + } + + private class Contract extends ServiceContract { + + public Contract(Class interfaceClass) { + super(interfaceClass); + } + } + +// TODO commented out the following test since it doesn't test refernences. +// TODO have a reference injeciton test in ScriptInstanceFactory that tests an actual invocation +// +// @SuppressWarnings("unchecked") +// public void testCreateInstanceWithRef() throws IOException { +// WireService wireService = createMock(WireService.class); +// expect(wireService.createProxy(isA(Wire.class))).andStubAnswer(new IAnswer() { +// public Object answer() throws Throwable { +// return Scope.MODULE; +// } +// }); +// +// ScriptComponent pc = new ScriptComponent(null, createBSFEasy(), new HashMap(), null, null, +// scopeContainer, wireService, null, null); +// OutboundWire wire = EasyMock.createMock(OutboundWire.class); +// EasyMock.expect(wire.getReferenceName()).andReturn("foo").atLeastOnce(); +// EasyMock.replay(wire); +// pc.addOutboundWire(wire); +// Object o = pc.createInstance(); +// assertNotNull(o); +// assertTrue(o instanceof ScriptInstance); +// } +// + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeLoaderTestCase.java new file mode 100644 index 0000000000..60893ec5f5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeLoaderTestCase.java @@ -0,0 +1,113 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import java.net.MalformedURLException; +import java.net.URL; + +import javax.xml.stream.XMLStreamException; + +import junit.framework.TestCase; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.loader.MissingSideFileException; +import org.easymock.EasyMock; +import org.easymock.IAnswer; + +public class ScriptComponentTypeLoaderTestCase extends TestCase { + + public void testGetSideFileName() { + ScriptComponentTypeLoader loader = new ScriptComponentTypeLoader(); + assertEquals("BSFEasyTestCase.componentType", loader.getSideFileName("BSFEasyTestCase.mock")); + } + + public void testGetSideFileNameNoDot() { + ScriptComponentTypeLoader loader = new ScriptComponentTypeLoader(); + assertEquals("BSFEasyTestCase.componentType", loader.getSideFileName("BSFEasyTestCase")); + } + + @SuppressWarnings("unchecked") + public void testLoad() throws MalformedURLException, LoaderException, XMLStreamException { + CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class); + DeploymentContext context = EasyMock.createNiceMock(DeploymentContext.class); + LoaderRegistry registry = EasyMock.createMock(LoaderRegistry.class); + registry.load(EasyMock.eq(parent), + EasyMock.isA(ScriptComponentType.class), + EasyMock.isA(URL.class), + EasyMock.isA(Class.class), + EasyMock.eq(context)); + EasyMock.expectLastCall().andStubAnswer(new IAnswer() { + public Object answer() throws Throwable { + return EasyMock.getCurrentArguments()[1]; + } + }); + EasyMock.replay(registry); + + ScriptImplementation implementation = new ScriptImplementation(); + implementation.setResourceName("org/apache/tuscany/container/script/helper/foo.componentType"); + implementation.setClassLoader(getClass().getClassLoader()); + ScriptComponentTypeLoader loader = new ScriptComponentTypeLoader(); + loader.setLoaderRegistry(registry); + loader.load(parent, implementation, context); + assertNotNull(implementation.getComponentType()); + } + + @SuppressWarnings("unchecked") + public void testLoadMissingSideFile() throws MalformedURLException, LoaderException, XMLStreamException { + CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class); + DeploymentContext context = EasyMock.createNiceMock(DeploymentContext.class); + LoaderRegistry registry = EasyMock.createMock(LoaderRegistry.class); + registry.load(EasyMock.eq(parent), + EasyMock.isA(ScriptComponentType.class), + EasyMock.isA(URL.class), + EasyMock.isA(Class.class), + EasyMock.eq(context)); + EasyMock.expectLastCall().andStubAnswer(new IAnswer() { + public Object answer() throws Throwable { + return EasyMock.getCurrentArguments()[1]; + } + }); + EasyMock.replay(registry); + + ScriptImplementation implementation = new ScriptImplementation(); + implementation.setResourceName("notthere"); + implementation.setClassLoader(getClass().getClassLoader()); + ScriptComponentTypeLoader loader = new ScriptComponentTypeLoader(); + loader.setLoaderRegistry(registry); + try { + loader.load(parent, implementation, context); + fail(); + } catch (MissingSideFileException e) { + //expected + } + } + + public void testGetImplementationClass() { + ScriptComponentTypeLoader loader = new ScriptComponentTypeLoader(); + assertEquals(ScriptImplementation.class, loader.getImplementationClass()); + } + + @Override + public void setUp() throws Exception { + super.setUp(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeTestCase.java new file mode 100644 index 0000000000..7809c63d99 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeTestCase.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import org.apache.tuscany.spi.model.Scope; + +import junit.framework.TestCase; + +public class ScriptComponentTypeTestCase extends TestCase { + + public void testLifecycleScope() { + ScriptComponentType ct = new ScriptComponentType(); + assertEquals(Scope.COMPOSITE, ct.getImplementationScope()); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderLoadingTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderLoadingTestCase.java new file mode 100644 index 0000000000..f30c1dca65 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderLoadingTestCase.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.loader.MissingResourceException; +import org.apache.tuscany.spi.model.ModelObject; + +import junit.framework.TestCase; +import static org.easymock.classextension.EasyMock.createMock; + +/** + * + */ +public class ScriptImplementationLoaderLoadingTestCase extends TestCase { + + private LoaderRegistry registry; + + private ScriptImplementationLoader loader; + + public void testLoadSource() throws LoaderException { + String script = + loader.loadSource(getClass().getClassLoader(), "org/apache/tuscany/container/script/helper/foo.mock"); + assertTrue(script.startsWith("hello")); + } + + public void testLoadSourceMissingResource() throws LoaderException { + try { + loader.loadSource(getClass().getClassLoader(), "doesnt.exist"); + fail(); + } catch (MissingResourceException e) { + // expected + } + } + + public void testGetXMLType() throws LoaderException { + assertEquals("http://foo", loader.getXMLType().getNamespaceURI()); + assertEquals("bar", loader.getXMLType().getLocalPart()); + } + + protected void setUp() throws Exception { + super.setUp(); + registry = createMock(LoaderRegistry.class); + loader = new ScriptImplementationLoader(registry) { + public QName getXMLType() { + return new QName("http://foo", "bar"); + } + + public ScriptImplementation load(CompositeComponent arg0, ModelObject arg1, XMLStreamReader arg2, + DeploymentContext arg3) throws XMLStreamException, LoaderException { + return null; + } + }; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderTestCase.java new file mode 100644 index 0000000000..62a5ee3110 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderTestCase.java @@ -0,0 +1,133 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import static org.easymock.EasyMock.expect; +import static org.easymock.classextension.EasyMock.createMock; +import static org.easymock.classextension.EasyMock.replay; +import static org.easymock.classextension.EasyMock.verify; +import static org.osoa.sca.Constants.SCA_NS; + +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import junit.framework.TestCase; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.loader.MissingResourceException; + +/** + * + */ +public class ScriptImplementationLoaderTestCase extends TestCase { + private CompositeComponent parent; + + private XMLStreamReader reader; + + private DeploymentContext deploymentContext; + + private ClassLoader classLoader; + + private LoaderRegistry registry; + + private ScriptImplementationLoader loader; + + public void testLoadNoScriptAttribute() throws LoaderException, XMLStreamException { + expect(reader.getAttributeValue(null, "script")).andReturn(null); + replay(reader); + replay(deploymentContext); + + try { + loader.load(parent, null, reader, deploymentContext); + fail(); + } catch (MissingResourceException e) { + // ok + } + verify(reader); + verify(deploymentContext); + } + + public void testLoad() throws LoaderException, XMLStreamException { + expect(reader.getAttributeValue(null, "script")).andReturn("foo.mock"); + expect(reader.getAttributeValue(null, "class")).andReturn(null); + expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT); + expect(deploymentContext.getClassLoader()).andReturn(classLoader); + + replay(reader); + replay(deploymentContext); + + ScriptImplementationLoader mockLoader = new ScriptImplementationLoader(registry) { + protected String loadSource(ClassLoader cl, String resource) throws LoaderException { + assertSame(classLoader, cl); + assertEquals("foo.mock", resource); + return "bar"; + } + }; + mockLoader.load(parent, null, reader, deploymentContext); + verify(reader); + verify(deploymentContext); + } + + public void testLoadNoScriptPresent() throws LoaderException, XMLStreamException { + expect(reader.getAttributeValue(null, "script")).andReturn("foo.py"); + expect(reader.getAttributeValue(null, "class")).andReturn(null); + expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT); + expect(deploymentContext.getClassLoader()).andReturn(classLoader); + + replay(reader); + replay(deploymentContext); + + ScriptImplementationLoader mockLoader = new ScriptImplementationLoader(registry) { + protected String loadSource(ClassLoader cl, String resource) throws LoaderException { + assertSame(classLoader, cl); + assertEquals("foo.py", resource); + throw new MissingResourceException(resource); + } + }; + try { + mockLoader.load(parent, null, reader, deploymentContext); + fail(); + } catch (MissingResourceException e) { + assertEquals("Missing resource", e.getMessage()); + assertEquals("foo.py", e.getIdentifier()); + } + verify(reader); + verify(deploymentContext); + } + + public void testGetXMLType() throws LoaderException { + assertEquals(SCA_NS, loader.getXMLType().getNamespaceURI()); + assertEquals("implementation.script", loader.getXMLType().getLocalPart()); + } + + protected void setUp() throws Exception { + super.setUp(); + registry = createMock(LoaderRegistry.class); + loader = new ScriptImplementationLoader(registry); + + parent = createMock(CompositeComponent.class); + reader = createMock(XMLStreamReader.class); + deploymentContext = createMock(DeploymentContext.class); + classLoader = createMock(ClassLoader.class); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationTestCase.java new file mode 100644 index 0000000000..11a99b5854 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationTestCase.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import junit.framework.TestCase; + +public class ScriptImplementationTestCase extends TestCase { + + public void testGetResourceName() { + ScriptImplementation impl = new ScriptImplementation(); + impl.setResourceName("foo"); + assertEquals("foo", impl.getResourceName()); + } + + public void setUp() throws Exception { + super.setUp(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java new file mode 100644 index 0000000000..40645e8dc8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; +import java.util.Map; + +import org.apache.tuscany.spi.ObjectCreationException; +import org.apache.tuscany.spi.ObjectFactory; + +import junit.framework.TestCase; +import org.apache.bsf.BSFManager; +import org.apache.tuscany.container.script.mock.MockBSFEngine; + +public class ScriptInstanceFactoryTestCase extends TestCase { + + public void testCreateInstance() throws InvocationTargetException { + BSFManager.registerScriptingEngine("mock", MockBSFEngine.class.getName(), new String[]{"mock"}); + ScriptInstanceFactory factory = + new ScriptInstanceFactory("foo.mock", "bar", "baz", getClass().getClassLoader()); + factory.addContextObjectFactory("foo", String.class, new SingletonObjectFactory("bar")); + ScriptInstance instance = (ScriptInstance) factory.getInstance(); + assertNotNull(instance); + assertNotNull(instance.bsfEngine); + } + + public void testCreateInstanceNoClass() throws InvocationTargetException { + BSFManager.registerScriptingEngine("mock", MockBSFEngine.class.getName(), new String[]{"mock"}); + ScriptInstanceFactory factory = + new ScriptInstanceFactory("foo.mock", null, "baz", getClass().getClassLoader()); + factory.addContextObjectFactory("foo", String.class, new SingletonObjectFactory("bar")); + ScriptInstance instance = (ScriptInstance) factory.getInstance(); + assertNotNull(instance); + assertNotNull(instance.bsfEngine); + } + + public void testCreateInstanceRuby() throws InvocationTargetException { + BSFManager.registerScriptingEngine("ruby", MockBSFEngine.class.getName(), new String[]{"mock"}); + ScriptInstanceFactory factory = + new ScriptInstanceFactory("foo.mock", "bar", "baz", getClass().getClassLoader()); + factory.addContextObjectFactory("foo", String.class, new SingletonObjectFactory("bar")); + ScriptInstance instance = (ScriptInstance) factory.getInstance(); + assertNotNull(instance); + assertNotNull(instance.bsfEngine); + } + + public void testBadCreateInstance() throws InvocationTargetException { + ScriptInstanceFactory factory = + new ScriptInstanceFactory("foo", "bar", "baz", getClass().getClassLoader()); + try { + factory.getInstance(); + fail(); + } catch (ObjectCreationException e) { + // expected + } + } + + public void testGetters() throws InvocationTargetException { + ScriptInstanceFactory factory = + new ScriptInstanceFactory("foo", "bar", "baz", getClass().getClassLoader()); + assertEquals(getClass().getClassLoader(), factory.getClassLoader()); + } + + + public void testGetResponseClasses() { + ScriptInstanceFactory factory = + new ScriptInstanceFactory("foo.mock", "bar", "baz", getClass().getClassLoader()); + Map classes = factory.getResponseClasses(Arrays.asList(new Class[]{Runnable.class})); + assertEquals(1, classes.size()); + assertEquals("run", classes.keySet().iterator().next()); + assertEquals(void.class, classes.get("run")); + } + + protected void setUp() throws Exception { + super.setUp(); + } + + private class SingletonObjectFactory implements ObjectFactory { + private Object instance; + + public SingletonObjectFactory(Object instance) { + this.instance = instance; + } + + public Object getInstance() throws ObjectCreationException { + return instance; + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceTestCase.java new file mode 100644 index 0000000000..0cf7d80723 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceTestCase.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import java.lang.reflect.InvocationTargetException; + +import junit.framework.TestCase; +import org.apache.tuscany.container.script.mock.MockBSFEngine; + +public class ScriptInstanceTestCase extends TestCase { + private ScriptInstance instance; + + public void testInvokeTarget() throws InvocationTargetException { + assertEquals("hello:", instance.invokeTarget("hello", null)); + } + + public void testInvokeTargetException() throws InvocationTargetException { + try { + instance.invokeTarget("bang", null); + fail(); + } catch (InvocationTargetException e) { + // expected + } + } + + protected void setUp() throws Exception { + super.setUp(); + this.instance = new ScriptInstance(new MockBSFEngine(), null); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java new file mode 100644 index 0000000000..5597d37e60 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.container.script; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.tuscany.spi.wire.TargetInvoker; + +import junit.framework.TestCase; +import org.easymock.IAnswer; +import org.easymock.classextension.EasyMock; + +public class ScriptInvokerTestCase extends TestCase { + + @SuppressWarnings("unchecked") + public void testInvokeTarget() throws Exception { + ScriptInstance instance = EasyMock.createMock(ScriptInstance.class); + instance.invokeTarget(EasyMock.eq("operation"), (Object[]) EasyMock.notNull()); + EasyMock.expectLastCall().andStubAnswer(new IAnswer() { + public Object answer() throws Throwable { + assertEquals(2, EasyMock.getCurrentArguments().length); + assertEquals("operation", EasyMock.getCurrentArguments()[0]); + return "hello"; + } + }); + + EasyMock.replay(instance); + ScriptComponent component = EasyMock.createMock(ScriptComponent.class); + EasyMock.expect(component.getTargetInstance()).andReturn(instance); + EasyMock.replay(component); + ScriptTargetInvoker invoker = new ScriptTargetInvoker("operation", component); + assertEquals("hello", invoker.invokeTarget(new Object[]{"petra"}, TargetInvoker.NONE)); + EasyMock.verify(instance); + EasyMock.verify(component); + } + + @SuppressWarnings("unchecked") + public void testInvokeTargetException() throws Exception { + ScriptInstance instance = EasyMock.createMock(ScriptInstance.class); + instance.invokeTarget(EasyMock.eq("operation"), (Object[]) EasyMock.notNull()); + EasyMock.expectLastCall().andStubAnswer(new IAnswer() { + public Object answer() throws Throwable { + throw new RuntimeException(); + } + }); + + EasyMock.replay(instance); + ScriptComponent component = EasyMock.createMock(ScriptComponent.class); + EasyMock.expect(component.getTargetInstance()).andReturn(instance); + EasyMock.replay(component); + ScriptTargetInvoker invoker = new ScriptTargetInvoker("operation", component); + try { + invoker.invokeTarget(new Object[]{"petra"}, TargetInvoker.NONE); + fail(); + } catch (InvocationTargetException e) { + // expected + } + EasyMock.verify(instance); + EasyMock.verify(component); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java new file mode 100644 index 0000000000..2bf1c21478 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java @@ -0,0 +1,30 @@ +package org.apache.tuscany.container.script.mock; + +import org.apache.bsf.BSFDeclaredBean; +import org.apache.bsf.BSFException; +import org.apache.bsf.util.BSFEngineImpl; + +public class MockBSFEngine extends BSFEngineImpl { + + public Object call(Object object, String name, Object[] args) throws BSFException { + if ("bang".equals(name)) { + throw new RuntimeException(name); + } + + String resp = name + ":"; + if (args != null) { + for (Object o : args) { + resp += " " + String.valueOf(o); + } + } + return resp; + } + + public Object eval(String source, int lineNo, int columnNo, Object expr) throws BSFException { + // not used for the mock tests + return null; + } + + public void declareBean(BSFDeclaredBean bean) throws BSFException { + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/foo.componentType b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/foo.componentType new file mode 100644 index 0000000000..9c37e1cb3e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/foo.componentType @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/foo.mock b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/foo.mock new file mode 100644 index 0000000000..b6fc4c620b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/foo.mock @@ -0,0 +1 @@ +hello \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType new file mode 100644 index 0000000000..9c37e1cb3e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock new file mode 100644 index 0000000000..b6fc4c620b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock @@ -0,0 +1 @@ +hello \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/LICENSE.txt new file mode 100644 index 0000000000..0084319535 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, serviceDefinition marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/pom.xml new file mode 100644 index 0000000000..eae5e5c7da --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/pom.xml @@ -0,0 +1,124 @@ + + + + + + org.apache.tuscany.sca.extensions + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-e4x + Apache Tuscany JavaScript E4X DataBinding + Apache Tuscany JavaScript E4X DataBinding + + + + + wso2-thilina + http://www-lk.wso2.com/~thilina/repository + + true + + legacy + + + + + wso2 + http://dist.wso2.org/maven + + true + + legacy + + + + + + + org.apache.tuscany.sca.kernel + tuscany-spi + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + org.mozilla.javascript + js-core + SNAPSHOT + compile + + + + org.wso2.javascript.rhino + js-axiom + SNAPSHOT + compile + + + + org.apache.ws.commons.axiom + axiom-impl + compile + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.easymock + easymock + + + + org.easymock + easymockclassextension + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2OMElement.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2OMElement.java new file mode 100644 index 0000000000..82d4f0b9a4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2OMElement.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.extensions.script.databinding.e4x; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.mozilla.javascript.xmlimpl.XML; +import org.osoa.sca.annotations.Service; + +@Service(Transformer.class) +public class E4X2OMElement extends TransformerExtension implements PullTransformer { + + public OMElement transform(XML source, TransformationContext context) { + return (OMElement)source.getAxiomFromXML(); + } + + public Class getSourceType() { + return XML.class; + } + + public Class getTargetType() { + return OMElement.class; + } + + public int getWeight() { + return 10; + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java new file mode 100644 index 0000000000..06c578866d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.extensions.script.databinding.e4x; + +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.SimpleType2JavaTransformer; +import org.mozilla.javascript.xmlimpl.XML; +import org.osoa.sca.annotations.Service; + +/** + * Transformer to convert data from a simple java bject to OMElement + */ +@Service(Transformer.class) +public class E4X2Object extends SimpleType2JavaTransformer { + + private E4X2OMElement e4x2om; + + public E4X2Object() { + e4x2om = new E4X2OMElement(); + } + + @Override + protected String getText(XML source) { + return e4x2om.transform(source, null).getText(); + } + + public Class getSourceType() { + return XML.class; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java new file mode 100644 index 0000000000..c9172b1229 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.extensions.script.databinding.e4x; + +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.WrapperHandler; +import org.apache.tuscany.spi.databinding.extension.DataBindingExtension; +import org.mozilla.javascript.xmlimpl.XML; +import org.osoa.sca.annotations.Service; + +/** + * DataBinding for E4X + * + * This requires Rhino using the WSO2 Axiom based E4X impl + */ +@Service(DataBinding.class) +public class E4XDataBinding extends DataBindingExtension { + + public static final String NAME = XML.class.getName(); + public static final String[] ALIASES = new String[] {"e4x"}; + + public E4XDataBinding() { + super(NAME, ALIASES, XML.class); + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.DataBindingExtension#getWrapperHandler() + */ + @Override + public WrapperHandler getWrapperHandler() { + return new E4XWrapperHandler(); + } + + /** + * Treat E4X as pass-by-ref + */ + public Object copy(Object source) { + return source; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XWrapperHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XWrapperHandler.java new file mode 100644 index 0000000000..6182aad77b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XWrapperHandler.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.extensions.script.databinding.e4x; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.WrapperHandler; +import org.apache.tuscany.spi.idl.ElementInfo; +import org.mozilla.javascript.xmlimpl.XML; + +/** + * OMElement wrapper handler implementation + */ +public class E4XWrapperHandler implements WrapperHandler { + + private OMFactory factory; + private OMElement2E4X om2e4x; + private E4X2OMElement e4x2om; + + public E4XWrapperHandler() { + this.factory = OMAbstractFactory.getOMFactory(); + om2e4x = new OMElement2E4X(); + e4x2om = new E4X2OMElement(); + } + + public XML create(ElementInfo element, TransformationContext context) { + OMElement wrapper = factory.createOMElement(element.getQName(), null); + return om2e4x.transform(wrapper, null); + } + + public void setChild(XML wrapper, int i, ElementInfo childElement, Object value) { + OMElement omWrapper = e4x2om.transform(wrapper, null); + OMElement element = e4x2om.transform((XML)value, null); + QName elementName = childElement.getQName(); + OMNamespace namespace = factory.createOMNamespace(elementName.getNamespaceURI(), elementName.getPrefix()); + element.setNamespace(namespace); + element.setLocalName(childElement.getQName().getLocalPart()); + omWrapper.addChild(element); + } + + public List getChildren(XML wrapper) { + OMElement omWrapper = e4x2om.transform(wrapper, null); + List elements = new ArrayList(); + for (Iterator i = omWrapper.getChildElements(); i.hasNext();) { + elements.add(om2e4x.transform((OMElement)i.next(), null)); + } + return elements; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/OMElement2E4X.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/OMElement2E4X.java new file mode 100644 index 0000000000..6ab0e42a75 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/OMElement2E4X.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.extensions.script.databinding.e4x; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.mozilla.javascript.Context; +import org.mozilla.javascript.ScriptableObject; +import org.mozilla.javascript.xmlimpl.XML; +import org.osoa.sca.annotations.Service; + +@Service(Transformer.class) +public class OMElement2E4X extends TransformerExtension implements PullTransformer { + + private ScriptableObject scope; + + public OMElement2E4X() { + Context cx = Context.enter(); + try { + + this.scope = cx.initStandardObjects(); + + } finally { + Context.exit(); + } + } + + public Class getSourceType() { + return OMElement.class; + } + + public Class getTargetType() { + return XML.class; + } + + public int getWeight() { + return 10; + } + + public XML transform(OMElement source, TransformationContext context) { + Context cx = Context.enter(); + try { + + return (XML)cx.newObject(scope, "XML", new Object[] {source}); + + } finally { + Context.exit(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java new file mode 100644 index 0000000000..31810d969b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.extensions.script.databinding.e4x; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.Java2SimpleTypeTransformer; +import org.mozilla.javascript.xmlimpl.XML; +import org.osoa.sca.annotations.Service; + +/** + * Transformer to convert data from an simple OMElement to Java Object + */ +@Service(Transformer.class) +public class Object2E4X extends Java2SimpleTypeTransformer { + + private OMFactory factory; + private OMElement2E4X om2e4x; + + public Object2E4X() { + factory = OMAbstractFactory.getOMFactory(); + om2e4x = new OMElement2E4X(); + } + + protected XML createElement(QName element, String text, TransformationContext context) { + OMElement omElement = factory.createOMElement(element, null); + factory.createOMText(omElement, text); + return om2e4x.transform(omElement, context); + } + + @Override + public Class getTargetType() { + return XML.class; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/databinding.e4x.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/databinding.e4x.scdl new file mode 100644 index 0000000000..66f7d9d9c1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/databinding.e4x.scdl @@ -0,0 +1,50 @@ + + + + + + + org.apache.tuscany.sca.extensions.script + databinding-e4x + 0.1-integration-incubating-SNAPSHOT + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..3428495aa6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,50 @@ + + + + + + + org.apache.tuscany.sca.extensions.script + databinding-e4x + 0.1-integration-incubating-SNAPSHOT + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/extension.composite new file mode 100644 index 0000000000..9156c64d54 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/extension.composite @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/pom.xml new file mode 100644 index 0000000000..72fa6c5616 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/pom.xml @@ -0,0 +1,138 @@ + + + + + + org.apache.tuscany.sca.extensions + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-bsf-itests + Apache Tuscany Script Container ITests + Apache Tuscany Script Container Itests + + + + + ant + http://people.apache.org/~antelder/maven2 + + true + + + + + + + + org.osoa + sca-api-r1.0 + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + org.apache.tuscany.sca.extensions + tuscany-bsf + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.extensions + tuscany-e4x + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.jruby + jruby + 0.9.2 + test + + + + jython + jython + 2.2b1 + test + + + + groovy + groovy-all + 1.0 + test + + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + 0.1-integration-incubating-SNAPSHOT + test + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + 0.1-integration-incubating-SNAPSHOT + test + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.HelloWorldServer + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..5fc0a052c5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +public interface CalculatorService { + + double add(double n1, double n2); + + double sub(double n1, double n2); + + double mul(double n1, double n2); + + double div(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..56a556ce3b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/calculator/DivideService.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +public interface DivideService { + double divide(double n1, double n2); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/helloworld.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/helloworld.composite new file mode 100644 index 0000000000..14977b87db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/helloworld.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/properties.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/properties.composite new file mode 100644 index 0000000000..17378bafe8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/properties.composite @@ -0,0 +1,79 @@ + + + + + + + + + + + Namaskaar + + + + + + + + + Namaste + + + + + + + + + Namaskaar + + + + + + + + + Namaste + + + + + + + + + Namaskaar + + + + + + + + + Namaste + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/references.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/references.composite new file mode 100644 index 0000000000..ff51f9f429 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/references.composite @@ -0,0 +1,43 @@ + + + + + + + HelloWorldJSComponent + + + + + HelloWorldJSComponent + + + + + HelloWorldJSComponent + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/xml.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/xml.composite new file mode 100644 index 0000000000..14b048eeac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/xml.composite @@ -0,0 +1,44 @@ + + + + + + + HelloWorldXMLJSComponent + + + + + + + + + HelloWorldXMLProxyJSComponent + + + + + HelloWorldXMLJSComponent + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.componentType b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.componentType new file mode 100644 index 0000000000..adbfd29266 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.componentType @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.py b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.py new file mode 100644 index 0000000000..86dbef9e4d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.py @@ -0,0 +1,56 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# +# +# +# This Python code is a simple sample that provides a Python implementation of +# the Calculator sample +# + + +# The module-level add function +def add(val1, val2): + result = float(val1) + float(val2) + print "Python - CalculatorImpl.add " + str(val1) + " + " + str(val2) + " = " + str(result) + return result + +# The module-level sub function +def sub(val1, val2): + result = float(val1) - float(val2) + print "Python - CalculatorImpl.sub " + str(val1) + " - " + str(val2) + " = " + str(result) + return result + +# The module-level mul function +def mul(val1, val2): + result = float(val1) * float(val2) + print "Python - CalculatorImpl.mul " + str(val1) + " * " + str(val2) + " = " + str(result) + return result + +# The module-level div function +def div(val1, val2): + + + print "Python - CalculatorImpl.div calling divideService to determine " + str(val1) + " / " + str(val2) + + # Use the divideService reference + result = divideService.divide(val1, val2) + + print "Python - CalculatorImpl.div divideService returned " + str(result) + + return result + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.rb b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.rb new file mode 100644 index 0000000000..c198719b89 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.rb @@ -0,0 +1,48 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + +class CalculatorImpl + + attr_writer :divideService + + def initialize() + print "Ruby - CalculatorImpl.initialize\n" + end + + def div(arg1, arg2) + print "Ruby - CalculatorImpl.div\n" + $divideService.divide(arg1.to_f, arg2.to_f) + end + + def add(arg1, arg2) + print "Ruby - CalculatorImpl.add\n" + arg1.to_f + arg2.to_f + end + + def sub(arg1, arg2) + print "Ruby - CalculatorImpl.sub\n" + arg1.to_f - arg2.to_f + end + + def mul(arg1, arg2) + print "Ruby - CalculatorImpl.mul\n" + arg1.to_f * arg2.to_f + end + +end \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.componentType b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.componentType new file mode 100644 index 0000000000..38704e597b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.componentType @@ -0,0 +1,30 @@ + + + + + + + + + false + false + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.py b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.py new file mode 100644 index 0000000000..3921731de6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.py @@ -0,0 +1,65 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# +# +# +# This Python code is a simple sample that provides a Python implementation of +# the Divide Service used in the Calculator sample +# +# Either use the divide function in the DivideClass class (using classes allows +# composite scoping to be used) +# e.g. in CalculatorComposite.composite use the line: +# +# +# Or just use the module-level divide function +# e.g. in CalculatorComposite.composite use the line: +# +# + + +class DivideClass: + "A class to handle dividing" + + def __init__(self): + print "Python - DivideImpl.DivideClass constructor" + + # The class-level divide function + def divide(self, val1, val2): + result = float(val1) / float(val2) + + print "Python - DivideImpl.DivideClass.divide " + str( val1 ) + " / " + str(val2) + " = " + str(result) + + # Use the doRounding property + if doRounding: + result = round(result) + print "Python - DivideImpl.DivideClass.divide is rounding the result to " + str(result) + + return result + +# The module-level divide function +def divide(val1, val2): + result = float(val1) / float(val2) + print "Python - DivideImpl.divide " + str(val1) + " / " + str(val2) + " = " + str(result) + + # Use the doRounding property + if doRounding: + result = round(result) + print "Python - DivideImpl.divide is rounding the result to " + str(result) + + return result + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.rb b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.rb new file mode 100644 index 0000000000..c6615bfcfa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.rb @@ -0,0 +1,39 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + +class DivideImpl + + attr_writer :round + + def initialize() + print "Ruby - DivideImpl.initialize\n" + end + + def divide(arg1, arg2) + print "Ruby - DivideImpl.divide ", arg1, " / ", arg2, "\n" + res = arg1.to_f / arg2.to_f + if @round then + res = res.round + print "DivideImpl.divide rounding\n" + end + print "DivideImpl.divide ", res, "\n" + res + end + +end \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/sample.calculator.composite b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/sample.calculator.composite new file mode 100644 index 0000000000..4006d3efe0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/sample.calculator.composite @@ -0,0 +1,45 @@ + + + + + + + + RubyDivideComponent + + + + + true + + + + + PythonDivideComponent + + + + + false + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.componentType b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.componentType new file mode 100644 index 0000000000..31bfe88206 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.componentType @@ -0,0 +1,27 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.groovy b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.groovy new file mode 100644 index 0000000000..7b42990e11 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.groovy @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +String getGreetings(s) { + return "groovyHello " + s; +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.js b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.js new file mode 100644 index 0000000000..d1ecf36dbf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.js @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +function getGreetings(s) { + return "jsHello " + s; +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.py b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.py new file mode 100644 index 0000000000..f082e01963 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.py @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def getGreetings(s): + return "pyHello " + s \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.rb b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.rb new file mode 100644 index 0000000000..16488714d5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.rb @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def getGreetings(s) + return "rbHello " + s +end + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.componentType b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.componentType new file mode 100644 index 0000000000..b35967862b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.componentType @@ -0,0 +1,29 @@ + + + + + + + + + Kia Ora + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.js b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.js new file mode 100644 index 0000000000..0e2333d3a7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.js @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +function getGreetings(s) { + return "js" + GREETING + " " + s; +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.py b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.py new file mode 100644 index 0000000000..d8c47be953 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.py @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def getGreetings(s): + return "py" + GREETING + " " + s \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.rb b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.rb new file mode 100644 index 0000000000..bc3a5a5c9e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.rb @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def getGreetings(s) + return "rb" + $GREETING + " " + s +end + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType new file mode 100644 index 0000000000..31bfe88206 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType @@ -0,0 +1,27 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.js b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.js new file mode 100644 index 0000000000..a55706dfe0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.js @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +var GREETING = "Yo!"; + +function getGreetings(s) { + return "js" + GREETING + " " + s; +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.py b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.py new file mode 100644 index 0000000000..a8365597a9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +GREETING = "Yo!" + +def getGreetings(s): + return "py" + GREETING + " " + s \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.rb b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.rb new file mode 100644 index 0000000000..5c86c179c0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.rb @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +$GREETING = "Yo!" + +def getGreetings(s) + return "rb" + $GREETING + " " + s +end + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType new file mode 100644 index 0000000000..297c1d28c0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.js b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.js new file mode 100644 index 0000000000..60f18e66f7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.js @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +function getGreetings(s) { + return "jsproxy" + ref.getGreetings(s); +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.py b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.py new file mode 100644 index 0000000000..edb3e0f04e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.py @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def getGreetings(s): + return "pyproxy" + ref.getGreetings(s) \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.rb b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.rb new file mode 100644 index 0000000000..9b503a3e05 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.rb @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def getGreetings(s) + return "rbproxy" + $ref.getGreetings(s) +end + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..68174d1ecd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.componentType b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.componentType new file mode 100644 index 0000000000..297c1d28c0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.componentType @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.js b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.js new file mode 100644 index 0000000000..2e6a35a695 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.js @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +function getGreetings(s) { + java.lang.System.out.println("in helloworld.js s:" + s); + return ref.getGreetings(s); +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.componentType b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.componentType new file mode 100644 index 0000000000..24b65f8f2d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.componentType @@ -0,0 +1,27 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.js b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.js new file mode 100644 index 0000000000..929dddf04e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.js @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +function getGreetings(xmlIn) { + java.lang.System.out.println(xmlIn); + var s = "e4xHi " + xmlIn..*::name; + var xmlOut = + + { s } + ; + + return xmlOut; +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.componentType b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.componentType new file mode 100644 index 0000000000..8ccd5cce98 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.componentType @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.js b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.js new file mode 100644 index 0000000000..6d403c2965 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.js @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +function getGreetings(xmlIn) { + java.lang.System.out.println("via proxy type of in: " + typeof xmlIn); + + var xmlOut = ref.getGreetings(xmlIn); + + java.lang.System.out.println("via proxy type of out: " + typeof xmlOut); + return xmlOut; +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/calculator/CalculatorClientTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/calculator/CalculatorClientTestCase.java new file mode 100644 index 0000000000..a98e3f000b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/calculator/CalculatorClientTestCase.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for caluclator service + */ +public class CalculatorClientTestCase extends TestCase { + + private CompositeContext compositeContext; + + public void testCalculatorRuby() throws Exception { + CalculatorService calculatorService = compositeContext.locateService(CalculatorService.class, "RubyCalculatorComponent"); + Assert.assertEquals(3.0, calculatorService.add(1,2)); + Assert.assertEquals(1.5, calculatorService.div(3,2)); + } + + public void testCalculatorPython() throws Exception { + CalculatorService calculatorService = compositeContext.locateService(CalculatorService.class, "PythonCalculatorComponent"); + Assert.assertEquals(3.0, calculatorService.add(1,2)); + Assert.assertEquals(1.5, calculatorService.div(3,2)); + } + + @Override + protected void setUp() throws Exception { + SCARuntime.start("calculator/sample.calculator.composite"); + this.compositeContext = CurrentCompositeContext.getContext(); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/HelloWorldClientTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/HelloWorldClientTestCase.java new file mode 100644 index 0000000000..e1c382a6bc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/HelloWorldClientTestCase.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for helloworld web service client + */ +public class HelloWorldClientTestCase extends TestCase { + + private CompositeContext compositeContext; + + public void testHelloWorldJavaScript() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, "HelloWorldJSComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("jsHello Petra", msg); + } + + public void testHelloWorldRuby() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, "HelloWorldRubyComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("rbHello Petra", msg); + } + + public void testHelloWorldPython() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, "HelloWorldPythonComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("pyHello Petra", msg); + } + +// TODO: Groovy doesn't work yet. Looks like a bug in the Groovy BSF engine +// public void testHelloWorldGroovy() throws Exception { +// HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, "HelloWorldGroovyComponent"); +// String msg = helloWorldService.getGreetings("Petra"); +// Assert.assertEquals("groovyHello Petra", msg); +// } + + @Override + protected void setUp() throws Exception { + SCARuntime.start("META-INF/sca/helloworld.composite"); + this.compositeContext = CurrentCompositeContext.getContext(); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/JavaScriptPropertiesTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/JavaScriptPropertiesTestCase.java new file mode 100644 index 0000000000..b87e96d365 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/JavaScriptPropertiesTestCase.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for using references in script components + */ +public class JavaScriptPropertiesTestCase extends TestCase { + + private CompositeContext compositeContext; + + public void testJavaScriptDefault() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldJSDefaultComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("jsKia Ora Petra", msg); + } + + public void testJavaScriptOverride() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldJSOverrideComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("jsNamaskaar Petra", msg); + } + + public void testJavaScriptDynDefault() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldJSDynDefaultComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("jsYo! Petra", msg); + } + + public void testJavaScriptDynOverride() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldJSDynOverrideComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("jsNamaste Petra", msg); + } + + @Override + protected void setUp() throws Exception { + SCARuntime.start("META-INF/sca/properties.composite"); + this.compositeContext = CurrentCompositeContext.getContext(); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/PythonPropertiesTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/PythonPropertiesTestCase.java new file mode 100644 index 0000000000..c26fddff70 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/PythonPropertiesTestCase.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for using references in script components + */ +public class PythonPropertiesTestCase extends TestCase { + + private CompositeContext compositeContext; + + public void testPythonDefault() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldPythonDefaultComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("pyKia Ora Petra", msg); + } + public void testPythonOverride() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldPythonOverrideComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("pyNamaskaar Petra", msg); + } + + public void testPythonDynDefault() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldPythonDynDefaultComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("pyYo! Petra", msg); + } + + public void testPythonDynOverride() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldPythonDynOverrideComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("pyNamaste Petra", msg); + } + + @Override + protected void setUp() throws Exception { + SCARuntime.start("META-INF/sca/properties.composite"); + this.compositeContext = CurrentCompositeContext.getContext(); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/ReferencesTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/ReferencesTestCase.java new file mode 100644 index 0000000000..04a7bf0de3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/ReferencesTestCase.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for using references in script components + */ +public class ReferencesTestCase extends TestCase { + + private CompositeContext compositeContext; + + public void testHelloWorldJavaScript() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldJSProxyComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("jsproxyjsHello Petra", msg); + } + + public void testHelloWorldPython() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldPythonProxyComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("pyproxyjsHello Petra", msg); + } + + public void testHelloWorldRuby() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldRubyProxyComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("rbproxyjsHello Petra", msg); + } + + @Override + protected void setUp() throws Exception { + SCARuntime.start("META-INF/sca/references.composite"); + this.compositeContext = CurrentCompositeContext.getContext(); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/RubyPropertiesTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/RubyPropertiesTestCase.java new file mode 100644 index 0000000000..262141f680 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/RubyPropertiesTestCase.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for using references in script components + */ +public class RubyPropertiesTestCase extends TestCase { + + private CompositeContext compositeContext; + + public void testRubyDefault() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldRubyDefaultComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("rbKia Ora Petra", msg); + } + public void testRubyOverride() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldRubyOverrideComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("rbNamaskaar Petra", msg); + } + + public void testRubyDynDefault() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldRubyDynDefaultComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("rbYo! Petra", msg); + } + public void testRubyDynOverride() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldRubyDynOverrideComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("rbNamaste Petra", msg); + } + + @Override + protected void setUp() throws Exception { + SCARuntime.start("META-INF/sca/properties.composite"); + this.compositeContext = CurrentCompositeContext.getContext(); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/XMLTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/XMLTestCase.java new file mode 100644 index 0000000000..4099559a2a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/XMLTestCase.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for using XML in script components + */ +public class XMLTestCase extends TestCase { + + private CompositeContext compositeContext; + + public void testHelloWorldJavaScript() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldJSComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("e4xHi Petra", msg); + } + + public void testHelloWorldJavaScript2() throws Exception { + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldJSViaProxyComponent"); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("e4xHi Petra", msg); + } + + @Override + protected void setUp() throws Exception { + SCARuntime.start("META-INF/sca/xml.composite"); + this.compositeContext = CurrentCompositeContext.getContext(); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/pom.xml new file mode 100644 index 0000000000..ff2eb81b50 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/script/pom.xml @@ -0,0 +1,40 @@ + + + + + + org.apache.tuscany.sca.extensions + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.script + parent + pom + Apache Tuscany SCA Extensions for Scripting + + + container.bsf + databinding.e4x + itests + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.checkstyle b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.checkstyle new file mode 100644 index 0000000000..3e57539570 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.checkstyle @@ -0,0 +1,24 @@ + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.pmd b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.pmd new file mode 100644 index 0000000000..ffc4fe2bbb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.pmd @@ -0,0 +1,20 @@ + + +true diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.ruleset new file mode 100644 index 0000000000..3886f07f2d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.ruleset @@ -0,0 +1,190 @@ + + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/LICENSE.txt new file mode 100644 index 0000000000..0084319535 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, serviceDefinition marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/pom.xml new file mode 100644 index 0000000000..6738f93bd5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/pom.xml @@ -0,0 +1,42 @@ + + + + + org.apache.tuscany.sca.kernel + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-api + jar + Apache Tuscany SCA API + Tuscany Application Programming Interfaces. + + + + org.osoa + sca-api-r${scaSpecVersion} + + + junit + junit + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCARuntime.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCARuntime.java new file mode 100644 index 0000000000..15b9731121 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCARuntime.java @@ -0,0 +1,251 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.api; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; + +import org.osoa.sca.ComponentContext; + +/** + * SCARuntime is used to start a Tuscany SCA runtime. + */ +public abstract class SCARuntime { + public static final String DEFAULT_SYSTEM_SCDL = "META-INF/tuscany/default-system.composite"; + public static final String SYSTEM_SCDL = "system.composite"; + public static final String EXTENSION_SCDL = "META-INF/sca/extension.composite"; + public static final String SERVICE_SCDL = "META-INF/sca/service.composite"; + public static final String META_APPLICATION_SCDL = "META-INF/sca/application.composite"; + public static final String APPLICATION_SCDL = "application.composite"; + + private static SCARuntime instance; + + /** + * Read the service name from a configuration file + * + * @param classLoader + * @param name The name of the service class + * @return A class name which extends/implements the service class + * @throws IOException + */ + private static String getServiceName(ClassLoader classLoader, String name) throws IOException { + InputStream is = classLoader.getResourceAsStream("META-INF/services/" + name); + if (is == null) { + return null; + } + BufferedReader reader = null; + try { + reader = new BufferedReader(new InputStreamReader(is)); + while (true) { + String line = reader.readLine(); + if (line == null) { + break; + } else if (!line.startsWith("#")) { + return line.trim(); + } + } + } finally { + if (reader != null) { + reader.close(); + } + } + return null; + } + + /** + * Returns a SCARuntime instance. If the system property "org.apache.tuscany.api.SCARuntime" is set, its value is + * used as the name of the implementation class. Otherwise, if the resource + * "META-INF/services/org.apache.tuscany.api.SCARuntime" can be loaded from the supplied classloader. Otherwise, it + * will use "org.apache.tuscany.core.bootstrap.DefaultSCARuntime" as the default. The named class is loaded from the + * supplied classloader and instantiated using its default (no-arg) constructor. + * + * @return + */ + private static SCARuntime newInstance(final ClassLoader classLoader) { + + try { + final String name = SCARuntime.class.getName(); + String className = AccessController.doPrivileged(new PrivilegedAction() { + public String run() { + return System.getProperty(name); + } + }); + + if (className == null) { + className = getServiceName(classLoader, name); + } + if (className == null) { + className = "org.apache.tuscany.core.bootstrap.DefaultSCARuntime"; + } + Class cls = Class.forName(className, true, classLoader); + return (SCARuntime)cls.newInstance(); // NOPMD lresende + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + /** + * Get an instance of SCA Runtime + * + * @return The instance + */ + public synchronized static SCARuntime getInstance() { // NOPMD + if (instance != null) { + return instance; + } + ClassLoader classLoader = SCARuntime.class.getClassLoader(); + instance = newInstance(classLoader); + return instance; + } + + /** + * Start the Tuscany runtime using default SCDLs + */ + public static void start() { + try { + getInstance().startup(null, null, null, null); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + /** + * Start the SCA Runtime with the given SCDLs + * + * @param system The URL for the system SCDL + * @param extensions An array of URLs for extensions + * @param application The URL for the application SCDL + */ + public static void start(URL system, URL[] extensions, URL application, String compositePath) { + try { + getInstance().startup(system, extensions, application, compositePath); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + /** + * Start the SCA Runtime with the given SCDL + * + * @param application The URL for the application SCDL + */ + public static void start(URL application, String compositePath) { + try { + getInstance().startup(null, null, application, compositePath); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + /** + * Start the SCA Runtime with the given SCDL + * + * @param compositePath The path of the application SCDL + */ + public static void start(String compositePath) { + try { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL applicationURL = cl.getResource(compositePath); + getInstance().startup(null, null, applicationURL, compositePath); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + /** + * Start the SCA Runtime with the given SCDL + * + * @param compositePath The path of the system SCDL + * @param compositePath The path of the application SCDL + */ + public static void start(String system, String compositePath) { + try { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL systemURL = cl.getResource(system); + URL applicationURL = cl.getResource(compositePath); + getInstance().startup(systemURL, null, applicationURL, compositePath); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + /** + * Get the ComponentContext by name + * + * @param componentName + * @return + */ + public static ComponentContext getComponentContext(String componentName) { + return getInstance().getContext(componentName); + } + + /** + * Get access to a system service + * + * @param serviceName + * @return + */ + protected abstract Object getSystemService(String serviceName); + + /** + * Stop the SCA Runtime + */ + public static void stop() { + try { + getInstance().shutdown(); + } catch (Exception e) { + throw new IllegalStateException(e); + } finally { + instance = null; + } + } + + /** + * Look up the ComponentContext by name + * + * @param componentName + * @return + */ + protected abstract ComponentContext getContext(String componentName); + + /** + * Start up the runtime + * + * @param system The URL of the SCDL for tuscany system composite + * @param extensions The URLs of the SCDLs for tuscany extension composites + * @param application The URL of the SCDL for the application composite + * @param compositePath The path of the application composite relative to the application URL + * @throws Exception + */ + protected abstract void startup(URL system, URL[] extensions, URL application, String compositePath) + throws Exception; + + /** + * Shutdown the runtime + * + * @throws Exception + */ + protected abstract void shutdown() throws Exception; +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/TuscanyException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/TuscanyException.java new file mode 100644 index 0000000000..ad649d716f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/TuscanyException.java @@ -0,0 +1,164 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.api; + +import java.util.ArrayList; +import java.util.List; +import java.util.Collections; +import java.io.PrintWriter; + +/** + * The root checked exception for the Tuscany runtime. + * + * @version $Rev$ $Date$ + */ +public abstract class TuscanyException extends Exception { + private static final long serialVersionUID = -7847121698339635268L; + private List contextStack; + private final String identifier; + + /** + * Override constructor from Exception. + * + * @see Exception + */ + public TuscanyException() { + super(); + this.identifier = null; + } + + /** + * Override constructor from Exception. + * + * @param message passed to Exception + * @see Exception + */ + public TuscanyException(String message) { + super(message); + this.identifier = null; + } + + /** + * Override constructor from Exception. + * + * @param message passed to Exception + * @param identifier additional error information referred to in the error message + * @see Exception + */ + public TuscanyException(String message, String identifier) { + super(message); + this.identifier = identifier; + } + + /** + * Override constructor from Exception. + * + * @param message passed to Exception + * @param cause passed to Exception + * @see Exception + */ + public TuscanyException(String message, Throwable cause) { + super(message, cause); + this.identifier = null; + } + + /** + * Override constructor from Exception. + * + * @param message passed to Exception + * @param identifier additional error information referred to in the error message + * @param cause passed to Exception + * @see Exception + */ + public TuscanyException(String message, String identifier, Throwable cause) { + super(message, cause); + this.identifier = identifier; + } + + /** + * Override constructor from Exception. + * + * @param cause passed to Exception + * @see Exception + */ + public TuscanyException(Throwable cause) { + super(cause); + this.identifier = null; + } + + /** + * Returns a collection of names representing the context call stack where the error occured. The top of the stack + * is the first element in the collection. + * + * @return a collection of names representing the context call stack + */ + public List returnContextNames() { + if (contextStack == null) { + contextStack = new ArrayList(); + } + return Collections.unmodifiableList(contextStack); + } + + /** + * Pushes a context name where an error occured onto the call stack. + * + * @param name the name of a context to push on the stack + */ + public void addContextName(String name) { + if (contextStack == null) { + contextStack = new ArrayList(); + } + contextStack.add(name); + } + + /** + * Returns a string representing additional error information referred to in the error message. + * + * @return additional error information + */ + public String getIdentifier() { + return identifier; + } + + public PrintWriter appendBaseMessage(PrintWriter writer) { + if (identifier == null && contextStack == null) { + if (super.getMessage() == null) { + return writer; + } + return writer.append(super.getMessage()); + } + if (super.getMessage() != null) { + writer.append(super.getMessage()); + } + if (identifier != null) { + writer.append(" [").append(identifier).append(']'); + } + return writer; + } + + public PrintWriter appendContextStack(PrintWriter writer) { + if (contextStack != null) { + writer.append("\nContext stack trace: "); + for (int i = contextStack.size() - 1; i >= 0; i--) { + writer.append('[').append(contextStack.get(i)).append(']'); + } + } + return writer; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/TuscanyRuntimeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/TuscanyRuntimeException.java new file mode 100644 index 0000000000..fc92c57fa0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/TuscanyRuntimeException.java @@ -0,0 +1,168 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.api; + +import java.util.ArrayList; +import java.util.List; +import java.util.Collections; +import java.io.PrintWriter; + +/** + * The root unchecked exception for the Tuscany runtime. + * + * @version $Rev$ $Date$ + */ + +public abstract class TuscanyRuntimeException extends RuntimeException { + private static final long serialVersionUID = -759677431966121786L; + private List contextStack; + private final String identifier; + + /** + * Override constructor from RuntimeException. + * + * @see RuntimeException + */ + public TuscanyRuntimeException() { + super(); + this.identifier = null; + } + + /** + * Override constructor from RuntimeException. + * + * @param message passed to RuntimeException + * @see RuntimeException + */ + public TuscanyRuntimeException(String message) { + super(message); + this.identifier = null; + } + + + /** + * Override constructor from Exception. + * + * @param message passed to Exception + * @param identifier additional error information referred to in the error message + * @see Exception + */ + protected TuscanyRuntimeException(String message, String identifier) { + super(message); + this.identifier = identifier; + } + + /** + * Override constructor from RuntimeException. + * + * @param message passed to RuntimeException + * @param cause passed to RuntimeException + * @see RuntimeException + */ + public TuscanyRuntimeException(String message, Throwable cause) { + super(message, cause); + this.identifier = null; + } + + + /** + * Override constructor from Exception. + * + * @param message passed to Exception + * @param identifier additional error information referred to in the error message + * @param cause passed to RuntimeException + * @see Exception + */ + protected TuscanyRuntimeException(String message, String identifier, Throwable cause) { + super(message, cause); + this.identifier = identifier; + } + + /** + * Override constructor from RuntimeException. + * + * @param cause passed to RuntimeException + * @see RuntimeException + */ + public TuscanyRuntimeException(Throwable cause) { + super(cause); + this.identifier = null; + } + + /** + * Returns a collection of names representing the context call stack where the error occured. The top of the stack + * is the first element in the collection. + * + * @return a collection of names representing the context call stack + */ + public List returnContextNames() { + if (contextStack == null) { + contextStack = new ArrayList(); + } + return Collections.unmodifiableList(contextStack); + } + + /** + * Pushes a context name where an error occured onto the call stack. + * + * @param name the name of a context to push on the stack + */ + public void addContextName(String name) { + if (contextStack == null) { + contextStack = new ArrayList(); + } + contextStack.add(name); + } + + /** + * Returns a string representing additional error information referred to in the error message. + * + * @return additional error information + */ + public String getIdentifier() { + return identifier; + } + + public PrintWriter appendBaseMessage(PrintWriter writer) { + if (identifier == null && contextStack == null) { + if (super.getMessage() == null) { + return writer; + } + return writer.append(super.getMessage()); + } + if (super.getMessage() != null) { + writer.append(super.getMessage()); + } + if (identifier != null) { + writer.append(" [").append(identifier).append(']'); + } + return writer; + } + + public PrintWriter appendContextStack(PrintWriter writer) { + if (contextStack != null) { + writer.append("Context stack trace: "); + for (int i = contextStack.size() - 1; i >= 0; i--) { + writer.append('[').append(contextStack.get(i)).append(']'); + } + } + return writer; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/DataType.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/DataType.java new file mode 100644 index 0000000000..33e67a60ae --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/DataType.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.api.annotation; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Used to demarcate expected data types for an operation + * + * @version $Rev$ $Date$ + */ +@Target({TYPE, METHOD, FIELD, PARAMETER}) +@Retention(RUNTIME) +public @interface DataType { + + /** + * Returns the unique name of the data binding + * @return the unique name of the data binding + */ + String name(); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/IDLMapping.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/IDLMapping.java new file mode 100644 index 0000000000..e8c88b6176 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/IDLMapping.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.api.annotation; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Annotation that can be applied to interfaces or methods to provide IDL mapping metadata + * + * @version $Rev$ $Date$ + */ +@Target({METHOD, TYPE}) +@Retention(RUNTIME) +public @interface IDLMapping { + + /** + * The name of the databinding for the wrapper + */ + String dataBinding() default ""; + + /** + * To indicate if the java interface/method is generated from a WSDL using wrapper style. + * + * @see javax.xml.ws.RequestWrapper + * @see javax.xml.ws.RequestWrapper + * + * @return + */ + boolean wrapperStyle() default true; +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/LogLevel.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/LogLevel.java new file mode 100644 index 0000000000..83c5df26d9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/LogLevel.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.api.annotation; + +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation that can be applied to methods in a monitoring interface to indicate to logging frameworks the severity of + * the event. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD}) +@Retention(RUNTIME) +public @interface LogLevel { + + /** + * The log level as specified by {@link java.util.logging.Level}. + */ + @SuppressWarnings({"JavaDoc"}) String value(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/Monitor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/Monitor.java new file mode 100644 index 0000000000..dea9489e5b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/Monitor.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.api.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * A system annotation to inject a monitor + * + * @version $Rev$ $Date$ + */ +@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Monitor { +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/Resource.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/Resource.java new file mode 100644 index 0000000000..a7158ab6b8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/Resource.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.api.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a resource should be provided to an implementation by the runtime. + * + * @version $Rev$ $Date$ + */ +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Resource { + + /** + * Denotes the name of the resource declared by the implementation. + */ + String name() default ""; + + /** + * Denotes if the resource is optional + */ + boolean optional() default false; + + /** + * Denotes the default name of the resource provided by the runtime environment. + */ + String mappedName() default ""; +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/test/java/org/apache/tuscany/api/TuscanyExceptionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/test/java/org/apache/tuscany/api/TuscanyExceptionTestCase.java new file mode 100644 index 0000000000..9f0674238f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/test/java/org/apache/tuscany/api/TuscanyExceptionTestCase.java @@ -0,0 +1,164 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.api; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; + +import junit.framework.TestCase; + +/** + * @version $Rev$ $Date$ + */ +public class TuscanyExceptionTestCase extends TestCase { + private static final Throwable CAUSE = new Throwable("Cause"); + private static final String IDENTIFIER = "IDENTIFIER"; + private static final String MESSAGE = "Message"; + private static final String CONTEXT1 = "CONTEXT1"; + private static final String CONTEXT2 = "CONTEXT2"; + + public void testNoArgConstructor() { + TuscanyException ex = new DummyException(); + assertNull(ex.getMessage()); + assertNull(ex.getCause()); + assertNull(ex.getIdentifier()); + assertTrue(ex.returnContextNames().isEmpty()); + } + + public void testMessageConstructor() { + TuscanyException ex = new DummyException(MESSAGE); + assertEquals(MESSAGE, ex.getMessage()); + assertNull(ex.getCause()); + assertNull(ex.getIdentifier()); + assertTrue(ex.returnContextNames().isEmpty()); + } + + public void testAppendBaseMessage() { + TuscanyException ex = new DummyException(MESSAGE, IDENTIFIER); + StringWriter writer = new StringWriter(); + PrintWriter pw = new PrintWriter(writer); + ex.appendBaseMessage(pw); + assertEquals("Message [IDENTIFIER]", writer.toString()); + } + + public void testAppendBaseMessageNoIdentifier() { + TuscanyException ex = new DummyException(MESSAGE); + StringWriter writer = new StringWriter(); + PrintWriter pw = new PrintWriter(writer); + ex.appendBaseMessage(pw); + assertEquals("Message", writer.toString()); + } + + public void testThrowableConstructor() { + TuscanyException ex = new DummyException(CAUSE); + assertEquals(CAUSE.getClass().getName() + ": " + CAUSE.getMessage(), ex.getMessage()); + assertEquals(CAUSE, ex.getCause()); + assertNull(ex.getIdentifier()); + assertTrue(ex.returnContextNames().isEmpty()); + } + + public void testMessageThrowableConstructor() { + TuscanyException ex = new DummyException(MESSAGE, CAUSE); + assertEquals(MESSAGE, ex.getMessage()); + assertEquals(CAUSE, ex.getCause()); + assertNull(ex.getIdentifier()); + assertTrue(ex.returnContextNames().isEmpty()); + } + + public void testContextStack() { + TuscanyException ex = new DummyException(MESSAGE); + List contexts = new ArrayList(); + contexts.add(CONTEXT1); + ex.addContextName(CONTEXT1); + assertEquals(contexts, ex.returnContextNames()); + contexts.add(CONTEXT2); + ex.addContextName(CONTEXT2); + assertEquals(contexts, ex.returnContextNames()); + } + + public void testAppendContextMessage() { + TuscanyException ex = new DummyException(MESSAGE); + ex.addContextName(CONTEXT1); + ex.addContextName(CONTEXT2); + StringWriter writer = new StringWriter(); + PrintWriter pw = new PrintWriter(writer); + ex.appendContextStack(pw); + assertEquals("\nContext stack trace: [CONTEXT2][CONTEXT1]", writer.toString()); + } + + public void testAddContext() throws Exception { + TuscanyException e = new DummyException(); + e.addContextName("foo"); + e.addContextName("bar"); + assertEquals("foo", e.returnContextNames().get(0)); + assertEquals("bar", e.returnContextNames().get(1)); + } + + public void testEmptyContext() throws Exception { + TuscanyException e = new DummyException(); + assertEquals(0, e.returnContextNames().size()); + } + + public void testGetMessage() throws Exception { + TuscanyException e = new DummyException(); + e.getMessage(); + } + + public void testFullMessage() throws Exception { + TuscanyException e = new DummyException("message", "foo"); + e.addContextName("foo"); + e.getMessage(); + } + + public void testImmutableContextNames() { + TuscanyException e = new DummyException("message", "foo"); + try { + e.returnContextNames().add("foo"); + fail(); + } catch (UnsupportedOperationException e1) { + // expected + } + } + + + public static class DummyException extends TuscanyException { + + public DummyException() { + } + + public DummyException(String message) { + super(message); + } + + + public DummyException(String message, String identifier) { + super(message, identifier); + } + + public DummyException(String message, Throwable cause) { + super(message, cause); + } + + public DummyException(Throwable cause) { + super(cause); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/test/java/org/apache/tuscany/api/TuscanyRuntimeExceptionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/test/java/org/apache/tuscany/api/TuscanyRuntimeExceptionTestCase.java new file mode 100644 index 0000000000..4addd5ab38 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/test/java/org/apache/tuscany/api/TuscanyRuntimeExceptionTestCase.java @@ -0,0 +1,142 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.api; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; + +import junit.framework.TestCase; + +/** + * @version $Rev$ $Date$ + */ +public class TuscanyRuntimeExceptionTestCase extends TestCase { + private static final Throwable CAUSE = new Throwable("Cause"); + private static final String MESSAGE = "Message"; + private static final String IDENTIFIER = "IDENTIFIER"; + private static final String CONTEXT1 = "CONTEXT1"; + private static final String CONTEXT2 = "CONTEXT2"; + + public void testNoArgConstructor() { + TuscanyRuntimeException ex = new DummyException(); + assertNull(ex.getMessage()); + assertNull(ex.getCause()); + assertNull(ex.getIdentifier()); + assertTrue(ex.returnContextNames().isEmpty()); + } + + public void testMessageConstructor() { + TuscanyRuntimeException ex = new DummyException(MESSAGE); + assertSame(MESSAGE, ex.getMessage()); + assertNull(ex.getCause()); + assertNull(ex.getIdentifier()); + assertTrue(ex.returnContextNames().isEmpty()); + } + + public void testThrowableConstructor() { + TuscanyRuntimeException ex = new DummyException(CAUSE); + assertEquals(CAUSE.getClass().getName() + ": " + CAUSE.getMessage(), ex.getMessage()); + assertSame(CAUSE, ex.getCause()); + assertNull(ex.getIdentifier()); + assertTrue(ex.returnContextNames().isEmpty()); + } + + public void testMessageThrowableConstructor() { + TuscanyRuntimeException ex = new DummyException(MESSAGE, CAUSE); + assertSame(MESSAGE, ex.getMessage()); + assertSame(CAUSE, ex.getCause()); + assertNull(ex.getIdentifier()); + assertTrue(ex.returnContextNames().isEmpty()); + } + + public void testIdentifier() { + TuscanyRuntimeException ex = new DummyException(MESSAGE, IDENTIFIER); + assertEquals(IDENTIFIER, ex.getIdentifier()); + } + + public void testContextStack() { + TuscanyRuntimeException ex = new DummyException(MESSAGE); + List contexts = new ArrayList(); + contexts.add(CONTEXT1); + ex.addContextName(CONTEXT1); + assertEquals(contexts, ex.returnContextNames()); + contexts.add(CONTEXT2); + ex.addContextName(CONTEXT2); + assertEquals(contexts, ex.returnContextNames()); + } + + public void testAppendContextMessage() { + TuscanyRuntimeException ex = new DummyException(MESSAGE); + ex.addContextName(CONTEXT1); + ex.addContextName(CONTEXT2); + StringWriter writer = new StringWriter(); + PrintWriter pw = new PrintWriter(writer); + ex.appendContextStack(pw); + assertEquals("Context stack trace: [CONTEXT2][CONTEXT1]", writer.toString()); + } + + public void testAppendBaseMessage() { + TuscanyRuntimeException ex = new DummyException(MESSAGE, IDENTIFIER); + StringWriter writer = new StringWriter(); + PrintWriter pw = new PrintWriter(writer); + ex.appendBaseMessage(pw); + assertEquals("Message [IDENTIFIER]", writer.toString()); + } + + public void testAppendBaseMessageNoIdentifier() { + TuscanyRuntimeException ex = new DummyException(MESSAGE); + StringWriter writer = new StringWriter(); + PrintWriter pw = new PrintWriter(writer); + ex.appendBaseMessage(pw); + assertEquals("Message", writer.toString()); + } + + public void testImmutableContextNames() { + TuscanyRuntimeException e = new DummyException("message", "foo"); + try { + e.returnContextNames().add("foo"); + fail(); + } catch (UnsupportedOperationException e1) { + // expected + } + } + + public static class DummyException extends TuscanyRuntimeException { + public DummyException() { + } + + public DummyException(String message) { + super(message); + } + + public DummyException(String message, String identifier) { + super(message, identifier); + } + + public DummyException(String message, Throwable cause) { + super(message, cause); + } + + public DummyException(Throwable cause) { + super(cause); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.checkstyle b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.checkstyle new file mode 100644 index 0000000000..142759d295 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.checkstyle @@ -0,0 +1,6 @@ + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.pmd b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.pmd new file mode 100644 index 0000000000..9606e17e2d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.pmd @@ -0,0 +1,2 @@ + +truefalse \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.ruleset new file mode 100644 index 0000000000..ba9b5ce886 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.ruleset @@ -0,0 +1,190 @@ + + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/LICENSE.txt new file mode 100644 index 0000000000..0084319535 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, serviceDefinition marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/pom.xml new file mode 100644 index 0000000000..7d902e083c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/pom.xml @@ -0,0 +1,96 @@ + + + + + org.apache.tuscany.sca.kernel + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-core + jar + Apache Tuscany SCA Core + Core Tuscany runtime. + + + + org.apache.tuscany.sca.kernel + tuscany-spi + ${pom.version} + compile + + + + org.apache.tuscany.sca.kernel + tuscany-host-api + ${sca.version} + compile + + + + org.apache.tuscany + commonj-api_r1.1 + + + + org.codehaus.woodstox + wstx-asl + + + + javax.servlet + servlet-api + 2.5 + + + + org.apache.geronimo.specs + geronimo-j2ee-connector_1.5_spec + + + + junit + junit + + + + org.easymock + easymockclassextension + + + + + + + src/main/resources + true + + + ${notice.dir} + META-INF + true + + LICENSE.txt + NOTICE.txt + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java new file mode 100644 index 0000000000..7727759a88 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.binding.local; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.tuscany.spi.wire.Interceptor; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.OutboundInvocationChain; +import org.apache.tuscany.spi.wire.TargetInvoker; + +/** + * Base class for dispatching to a composite reference using the local binding + * + * @version $Rev$ $Date$ + */ +public abstract class AbstractLocalTargetInvoker implements TargetInvoker { + protected boolean cacheable; + + public boolean isCacheable() { + return cacheable; + } + + public void setCacheable(boolean cacheable) { + this.cacheable = cacheable; + } + + public boolean isOptimizable() { + return isCacheable(); // we only need to check if the scopes are correct + } + + public Object invokeTarget(final Object payload, short sequence) throws InvocationTargetException { + throw new InvocationTargetException(new UnsupportedOperationException()); + } + + protected Message invoke(OutboundInvocationChain chain, TargetInvoker invoker, Message msg) throws Throwable { + Interceptor headInterceptor = chain.getHeadInterceptor(); + if (headInterceptor == null) { + try { + // short-circuit the dispatch and invoke the target directly + if (invoker == null) { + String name = chain.getOperation().getName(); + throw new AssertionError("No target invoker [" + name + "]"); + } + return invoker.invoke(msg); + } catch (InvocationRuntimeException e) { + // the cause was thrown by the target so throw it + throw e.getCause(); + } + } else { + msg.setTargetInvoker(invoker); + return headInterceptor.invoke(msg); + } + } + + @Override + public AbstractLocalTargetInvoker clone() throws CloneNotSupportedException { + return (AbstractLocalTargetInvoker) super.clone(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java new file mode 100644 index 0000000000..c62523889d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.binding.local; + +import org.apache.tuscany.spi.builder.BuilderException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.ReferenceBinding; +import org.apache.tuscany.spi.component.ServiceBinding; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.BindingBuilderExtension; +import org.apache.tuscany.spi.model.AbstractReferenceDefinition; +import org.apache.tuscany.spi.model.ServiceDefinition; + +/** + * Creates runtime artifacts for the local binding + * + * @version $Rev$ $Date$ + */ +public class LocalBindingBuilder extends BindingBuilderExtension { + + protected Class getBindingType() { + return LocalBindingDefinition.class; + } + + public ServiceBinding build(CompositeComponent parent, + ServiceDefinition serviceDefinition, + LocalBindingDefinition bindingDefinition, + DeploymentContext deploymentContext) + throws BuilderException { + return new LocalServiceBinding(serviceDefinition.getName(), parent); + } + + + public ReferenceBinding build(CompositeComponent parent, + AbstractReferenceDefinition referenceDefinition, + LocalBindingDefinition bindingDefinition, + DeploymentContext deploymentContext) throws BuilderException { + return new LocalReferenceBinding(referenceDefinition.getName(), parent); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java new file mode 100644 index 0000000000..4df3e413dc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.binding.local; + +import java.net.URI; + +import org.apache.tuscany.spi.model.BindingDefinition; + + +/** + * Represents the local by-reference binding + * + * @version $Rev$ $Date$ + */ +public class LocalBindingDefinition extends BindingDefinition implements Cloneable { + + public LocalBindingDefinition() { + } + + public LocalBindingDefinition(URI targetUri) { + super(targetUri); + } + + public Object clone() { + LocalBindingDefinition clone = new LocalBindingDefinition(); + clone.setTargetUri(URI.create(getTargetUri().toString())); + return clone; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java new file mode 100644 index 0000000000..777beeb00e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.binding.local; + +import java.net.URI; +import java.net.URISyntaxException; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.model.ModelObject; +import org.apache.tuscany.spi.wire.Wire; + +/** + * Loader responsible for handling the local binding + * + * @version $Rev$ $Date$ + */ +public class LocalBindingLoader extends LoaderExtension { + + /** + * Constructor specifies the registry to register with. + * + * @param registry the LoaderRegistry this loader should register with + */ + public LocalBindingLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + public QName getXMLType() { + return Wire.LOCAL_BINDING; + } + + public LocalBindingDefinition load(CompositeComponent parent, + ModelObject object, + XMLStreamReader reader, + DeploymentContext deploymentContext) throws XMLStreamException, LoaderException { + String uri = reader.getAttributeValue(null, "uri"); + if (uri != null) { + try { + return new LocalBindingDefinition(new URI(uri)); + } catch (URISyntaxException e) { + throw new LoaderException(e); + } + } + return new LocalBindingDefinition(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java new file mode 100644 index 0000000000..03f42ca99c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.binding.local; + +import java.util.Map; + +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.MessageImpl; +import org.apache.tuscany.spi.wire.OutboundInvocationChain; +import org.apache.tuscany.spi.wire.TargetInvoker; + +/** + * Dispatches a callback invocation to the callback instance + * + * @version $Rev$ $Date$ + */ +public class LocalCallbackTargetInvoker extends AbstractLocalTargetInvoker { + private Operation operation; + private InboundWire inboundWire; + + public LocalCallbackTargetInvoker(Operation operation, InboundWire inboundWire) { + assert operation != null : "Operation method cannot be null"; + this.operation = operation; + this.inboundWire = inboundWire; + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + return invoke(operation, msg); + } catch (Throwable e) { + Message faultMsg = new MessageImpl(); + faultMsg.setBodyWithFault(e); + return faultMsg; + } + } + + private Message invoke(Operation operation, Message msg) throws Throwable { + Object targetAddress = msg.popFromAddress(); + if (targetAddress == null) { + throw new AssertionError("Popped a null from address from message"); + } + //TODO optimize as this is slow in local invocations + Map, OutboundInvocationChain> sourceCallbackInvocationChains = + inboundWire.getSourceCallbackInvocationChains(targetAddress); + OutboundInvocationChain chain = sourceCallbackInvocationChains.get(operation); + TargetInvoker invoker = chain.getTargetInvoker(); + return invoke(chain, invoker, msg); + } + + @Override + public LocalCallbackTargetInvoker clone() throws CloneNotSupportedException { + return (LocalCallbackTargetInvoker) super.clone(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java new file mode 100644 index 0000000000..9117fe903e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.binding.local; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.CoreRuntimeException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.TargetInvokerCreationException; +import org.apache.tuscany.spi.extension.ReferenceBindingExtension; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.TargetInvoker; +import org.apache.tuscany.spi.wire.Wire; + +/** + * The runtime representaion of the local reference binding + * + * @version $Rev$ $Date$ + */ +public class LocalReferenceBinding extends ReferenceBindingExtension { + + public LocalReferenceBinding(String name, CompositeComponent parent) throws CoreRuntimeException { + super(name, parent); + } + + public QName getBindingType() { + return Wire.LOCAL_BINDING; + } + + public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) + throws TargetInvokerCreationException { + if (operation.isCallback()) { + return new LocalCallbackTargetInvoker(operation, inboundWire); + } else { + return new LocalTargetInvoker(operation, outboundWire); + } + } + + public TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation) + throws TargetInvokerCreationException { + return new LocalCallbackTargetInvoker(operation, inboundWire); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java new file mode 100644 index 0000000000..6205172d7b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.binding.local; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.CoreRuntimeException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.TargetInvokerCreationException; +import org.apache.tuscany.spi.extension.ServiceBindingExtension; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.TargetInvoker; +import org.apache.tuscany.spi.wire.Wire; + +/** + * The runtime representaion of the local service binding + * + * @version $Rev$ $Date$ + */ +public class LocalServiceBinding extends ServiceBindingExtension { + + public LocalServiceBinding(String name, CompositeComponent parent) throws CoreRuntimeException { + super(name, parent); + } + + public QName getBindingType() { + return Wire.LOCAL_BINDING; + } + + public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) + throws TargetInvokerCreationException { + if (operation.isCallback()) { + return new LocalCallbackTargetInvoker(operation, getInboundWire()); + } else { + return new LocalTargetInvoker(operation, outboundWire); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java new file mode 100644 index 0000000000..5b564c93b8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.binding.local; + +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.MessageImpl; +import org.apache.tuscany.spi.wire.OutboundInvocationChain; +import org.apache.tuscany.spi.wire.OutboundWire; +import org.apache.tuscany.spi.wire.TargetInvoker; + +/** + * Dispatches an invocation through a composite service or reference using the local binding + * + * @version $Rev$ $Date$ + */ +public class LocalTargetInvoker extends AbstractLocalTargetInvoker { + private OutboundInvocationChain chain; + private Object fromAddress; + private boolean contractHasCallback; + + public LocalTargetInvoker(Operation operation, OutboundWire outboundWire) { + assert operation != null; + chain = outboundWire.getInvocationChains().get(operation); + assert chain != null; + fromAddress = (outboundWire.getContainer() == null) ? null : outboundWire.getContainer().getName(); + contractHasCallback = outboundWire.getServiceContract().getCallbackClass() != null; + } + + @Override + public LocalTargetInvoker clone() throws CloneNotSupportedException { + return (LocalTargetInvoker) super.clone(); + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + TargetInvoker invoker = chain.getTargetInvoker(); + assert invoker != null; + // Pushing the from address only needs to happen in the outbound (forward) direction for callbacks + if (contractHasCallback) { + msg.pushFromAddress(fromAddress); + } + + return invoke(chain, invoker, msg); + } catch (Throwable e) { + Message faultMsg = new MessageImpl(); + faultMsg.setBodyWithFault(e); + return faultMsg; + } + } + + + public boolean isOptimizable() { + return true; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/Bootstrapper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/Bootstrapper.java new file mode 100644 index 0000000000..0f6b4a2c92 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/Bootstrapper.java @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.bootstrap; + +import org.apache.tuscany.host.MonitorFactory; +import org.apache.tuscany.spi.bootstrap.RuntimeComponent; +import org.apache.tuscany.spi.builder.Connector; +import org.apache.tuscany.spi.component.ScopeRegistry; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.deployer.Deployer; +import org.apache.tuscany.spi.implementation.java.Introspector; +import org.apache.tuscany.spi.loader.Loader; +import org.apache.tuscany.spi.loader.PropertyObjectFactory; + +/** + * Interface that abstracts the process used to create a running Tuscany system. Implementation of this may provide + * different mechanisms for creating the primoridal system components used to boot the core to the level where it can + * support end-user applications. + * + * @version $Rev$ $Date$ + */ +public interface Bootstrapper { + /** + * Return the MonitorFactory being used by the implementation to provide monitor interfaces for the primordial + * components. + * + * @return the MonitorFactory being used by the bootstrapper + */ + MonitorFactory getMonitorFactory(); + + /** + * Create the RuntimeComponent that forms the fundamental root of the component assembly. This component has two + * children: a {@link org.apache.tuscany.spi.component.CompositeComponent} that is the root for all system + * components, and a {@link org.apache.tuscany.spi.component.CompositeComponent} that is the root for all + * application components. + * + * @return a new RuntimeComponent; basically a new Tuscany instance + */ + RuntimeComponent createRuntime(); + + /** + * Create a Deployer that can be used to deploy the system definition. This will most likely only support a small + * subset of the available programming model. + * + * @return a new primordial Deployer + */ + Deployer createDeployer(); + + /** + * Create a Loader for parsing a system definition represented as a XML SCDL file. + * + * @param propertyFactory the StAXPropertyFactory to be used to parse property values + * @param introspector the introspector to be used to extract component type information from a Java class + * @return a new prmordial Loader + */ + Loader createLoader(PropertyObjectFactory propertyFactory, Introspector introspector); + + /** + * Create a ScopeRegistry that supports the Scopes supported for primordial components + * + * @param workContext the WorkContext the Scopes should use + * @return a new primordial ScopeRegistry + */ + ScopeRegistry createScopeRegistry(WorkContext workContext); + + /** + * Create a Connector that can wire together primordial components. + * + * @return a new primordial Connector + */ + Connector createConnector(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java new file mode 100644 index 0000000000..762568eb01 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java @@ -0,0 +1,262 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.bootstrap; + +import javax.xml.stream.XMLInputFactory; + +import org.apache.tuscany.spi.bootstrap.ComponentNames; +import org.apache.tuscany.spi.bootstrap.RuntimeComponent; +import org.apache.tuscany.spi.builder.Builder; +import org.apache.tuscany.spi.builder.Connector; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.ScopeContainerMonitor; +import org.apache.tuscany.spi.component.ScopeRegistry; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.deployer.Deployer; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry; +import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService; +import org.apache.tuscany.spi.implementation.java.Introspector; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.loader.PropertyObjectFactory; +import org.apache.tuscany.spi.services.management.TuscanyManagementService; + +import org.apache.tuscany.core.binding.local.LocalBindingBuilder; +import org.apache.tuscany.core.binding.local.LocalBindingDefinition; +import org.apache.tuscany.core.binding.local.LocalBindingLoader; +import org.apache.tuscany.core.builder.BuilderRegistryImpl; +import org.apache.tuscany.core.builder.ConnectorImpl; +import org.apache.tuscany.core.component.WorkContextImpl; +import org.apache.tuscany.core.component.scope.CompositeScopeObjectFactory; +import org.apache.tuscany.core.component.scope.ScopeRegistryImpl; +import org.apache.tuscany.core.deployer.DeployerImpl; +import org.apache.tuscany.core.idl.java.InterfaceJavaLoader; +import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl; +import org.apache.tuscany.core.implementation.IntrospectionRegistryImpl; +import org.apache.tuscany.core.implementation.composite.CompositeComponentImpl; +import org.apache.tuscany.core.implementation.composite.CompositeLoader; +import org.apache.tuscany.core.implementation.processor.ConstructorProcessor; +import org.apache.tuscany.core.implementation.processor.DestroyProcessor; +import org.apache.tuscany.core.implementation.processor.EagerInitProcessor; +import org.apache.tuscany.core.implementation.processor.HeuristicPojoProcessor; +import org.apache.tuscany.core.implementation.processor.ImplementationProcessorServiceImpl; +import org.apache.tuscany.core.implementation.processor.InitProcessor; +import org.apache.tuscany.core.implementation.processor.MonitorProcessor; +import org.apache.tuscany.core.implementation.processor.PropertyProcessor; +import org.apache.tuscany.core.implementation.processor.ReferenceProcessor; +import org.apache.tuscany.core.implementation.processor.ResourceProcessor; +import org.apache.tuscany.core.implementation.processor.ScopeProcessor; +import org.apache.tuscany.core.implementation.processor.ServiceProcessor; +import org.apache.tuscany.core.implementation.system.builder.SystemComponentBuilder; +import org.apache.tuscany.core.implementation.composite.SystemCompositeBuilder; +import org.apache.tuscany.core.implementation.system.loader.SystemComponentTypeLoader; +import org.apache.tuscany.core.implementation.system.loader.SystemCompositeComponentTypeLoader; +import org.apache.tuscany.core.implementation.system.loader.SystemImplementationLoader; +import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation; +import org.apache.tuscany.core.implementation.system.model.SystemImplementation; +import org.apache.tuscany.core.loader.ComponentLoader; +import org.apache.tuscany.core.loader.ComponentTypeElementLoader; +import org.apache.tuscany.core.loader.IncludeLoader; +import org.apache.tuscany.core.loader.LoaderRegistryImpl; +import org.apache.tuscany.core.loader.PropertyLoader; +import org.apache.tuscany.core.loader.ReferenceLoader; +import org.apache.tuscany.core.loader.ServiceLoader; +import org.apache.tuscany.core.property.PropertyObjectFactoryImpl; +import org.apache.tuscany.core.wire.jdk.JDKWireService; +import org.apache.tuscany.host.MonitorFactory; + +/** + * A default implementation of a Bootstrapper. Please see the documentation on the individual methods for how the + * primordial components are created. + * + * @version $Rev$ $Date$ + */ +public class DefaultBootstrapper implements Bootstrapper { + private final MonitorFactory monitorFactory; + private final XMLInputFactory xmlFactory; + private final TuscanyManagementService managementService; + + /** + * Create a default bootstrapper. + * + * @param monitorFactory the MonitorFactory to be used to create monitors for the primordial components + * @param xmlFactory the XMLInputFactory to be used by the components to load XML artifacts + * @param managementService management service used by the runtime. + */ + public DefaultBootstrapper(MonitorFactory monitorFactory, + XMLInputFactory xmlFactory, + TuscanyManagementService managementService) { + this.monitorFactory = monitorFactory; + this.xmlFactory = xmlFactory; + this.managementService = managementService; + } + + /** + * Returns the MonitorFactory being used by this bootstrapper. + * + * @return the MonitorFactory being used by this bootstrapper + */ + public MonitorFactory getMonitorFactory() { + return monitorFactory; + } + + /** + * Create the RuntimeComponent that will form the root of the component tree. Returns an new instance of a {@link + * DefaultRuntime} with the system and application root components initialized with default composite components. + * + * @return a newly created root for the component tree + */ + public RuntimeComponent createRuntime() { + DefaultRuntime runtime = new DefaultRuntime(); + CompositeComponent systemComponent = + new CompositeComponentImpl(ComponentNames.TUSCANY_SYSTEM_ROOT, runtime, null, true); + runtime.setSystemComponent(systemComponent); + CompositeComponent rootComponent = + new CompositeComponentImpl(ComponentNames.TUSCANY_APPLICATION_ROOT, runtime, null, null); + runtime.setRootComponent(rootComponent); + return runtime; + } + + /** + * Create primordial deployer that can be used to load the system definition. + * + * @return the primordial deployer + */ + public Deployer createDeployer() { + ScopeRegistry scopeRegistry = createScopeRegistry(new WorkContextImpl()); + Builder builder = createBuilder(scopeRegistry); + JavaInterfaceProcessorRegistry interfaceIntrospector = new JavaInterfaceProcessorRegistryImpl(); + Introspector introspector = createIntrospector(interfaceIntrospector); + LoaderRegistry loader = createLoader(new PropertyObjectFactoryImpl(), introspector); + DeployerImpl deployer = new DeployerImpl(xmlFactory, loader, builder); + deployer.setMonitor(getMonitorFactory().getMonitor(ScopeContainerMonitor.class)); + return deployer; + } + + /** + * Create a basic ScopeRegistry containing the ScopeContainers that are available to components in the system + * definition. The implementation returned only support COMPOSITE scope. + * + * @param workContext the WorkContext the scopes should use + * @return a new ScopeRegistry + */ + public ScopeRegistry createScopeRegistry(WorkContext workContext) { + ScopeRegistry scopeRegistry = new ScopeRegistryImpl(); + new CompositeScopeObjectFactory(scopeRegistry, monitorFactory.getMonitor(ScopeContainerMonitor.class)); + return scopeRegistry; + } + + /** + * Create a Loader that can be used to parse an XML file containing the SCDL for the system definition. The + * following Implementation types are supported:
  • SystemImplementation
  • + *
  • SystemCompositeImplementation
and the following SCDL elements are supported:
    + *
  • composite
  • component
  • componentType
  • interface.java
  • property
  • + *
  • reference
  • service
  • implementation.system
Note the Java component type and the + * WSDL interface type are not supported. + * + * @param propertyFactory the StAXPropertyFactory to be used for parsing Property values + * @param introspector the Introspector to be used to inspect component implementations + * @return a new StAX XML loader + */ + public LoaderRegistry createLoader(PropertyObjectFactory propertyFactory, Introspector introspector) { + LoaderRegistryImpl loaderRegistry = + new LoaderRegistryImpl(monitorFactory.getMonitor(LoaderRegistryImpl.Monitor.class)); + + // register component type loaders + loaderRegistry.registerLoader(SystemImplementation.class, new SystemComponentTypeLoader(introspector)); + loaderRegistry.registerLoader(SystemCompositeImplementation.class, + new SystemCompositeComponentTypeLoader(loaderRegistry)); + + // register element loaders + registerLoader(loaderRegistry, new ComponentLoader(loaderRegistry, propertyFactory)); + registerLoader(loaderRegistry, new ComponentTypeElementLoader(loaderRegistry)); + registerLoader(loaderRegistry, new CompositeLoader(loaderRegistry, null)); + registerLoader(loaderRegistry, new IncludeLoader(loaderRegistry)); + JavaInterfaceProcessorRegistryImpl processorRegistry = new JavaInterfaceProcessorRegistryImpl(); + registerLoader(loaderRegistry, new InterfaceJavaLoader(loaderRegistry, processorRegistry)); + registerLoader(loaderRegistry, new PropertyLoader(loaderRegistry)); + registerLoader(loaderRegistry, new ReferenceLoader(loaderRegistry)); + registerLoader(loaderRegistry, new ServiceLoader(loaderRegistry)); + registerLoader(loaderRegistry, new SystemImplementationLoader(loaderRegistry)); + registerLoader(loaderRegistry, new LocalBindingLoader(loaderRegistry)); + return loaderRegistry; + } + + /** + * Create new Introspector for extracting a ComponentType definition from a Java class. + * + * @return a new Introspector + */ + public Introspector createIntrospector(JavaInterfaceProcessorRegistry registry) { + ImplementationProcessorService service = new ImplementationProcessorServiceImpl(registry); + IntrospectionRegistryImpl.Monitor monitor = monitorFactory.getMonitor(IntrospectionRegistryImpl.Monitor.class); + IntrospectionRegistryImpl introspectionRegistry = new IntrospectionRegistryImpl(monitor); + introspectionRegistry.registerProcessor(new ConstructorProcessor(service)); + introspectionRegistry.registerProcessor(new DestroyProcessor()); + introspectionRegistry.registerProcessor(new InitProcessor()); + introspectionRegistry.registerProcessor(new EagerInitProcessor()); + introspectionRegistry.registerProcessor(new ScopeProcessor()); + introspectionRegistry.registerProcessor(new PropertyProcessor(service)); + introspectionRegistry.registerProcessor(new ReferenceProcessor(registry)); + introspectionRegistry.registerProcessor(new ResourceProcessor()); + introspectionRegistry.registerProcessor(new ServiceProcessor(service)); + introspectionRegistry.registerProcessor(new HeuristicPojoProcessor(service)); + introspectionRegistry.registerProcessor(new MonitorProcessor(monitorFactory, service)); + return introspectionRegistry; + } + + /** + * Create a new Connector that can be used to wire primordial components together. + * + * @return a new Connector + */ + public Connector createConnector() { + return new ConnectorImpl(); + } + + /** + * Helper method for registering a loader with the registry. The Loader is registered once for the QName returned by + * its {@link LoaderExtension#getXMLType()} method. + * + * @param registry the LoaderRegistry to register with + * @param loader the Loader to register + */ + protected void registerLoader(LoaderRegistry registry, LoaderExtension loader) { + registry.registerLoader(loader.getXMLType(), loader); + } + + /** + * Create a Builder that can be used to build the components in the system definition. The default implementation + * only supports implementations from the system programming model. + * + * @param scopeRegistry the ScopeRegistry defining the component scopes that will be supported + * @return a new Builder + */ + private Builder createBuilder(ScopeRegistry scopeRegistry) { + BuilderRegistryImpl builderRegistry = + new BuilderRegistryImpl(scopeRegistry, new JDKWireService()); + SystemCompositeBuilder builder = + new SystemCompositeBuilder(builderRegistry, createConnector(), managementService); + builderRegistry.register(SystemCompositeImplementation.class, builder); + builderRegistry.register(SystemImplementation.class, new SystemComponentBuilder()); + builderRegistry.register(LocalBindingDefinition.class, new LocalBindingBuilder()); + return builderRegistry; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultRuntime.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultRuntime.java new file mode 100644 index 0000000000..978d10fc37 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultRuntime.java @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.bootstrap; + +import java.util.HashMap; +import java.util.Map; + +import org.w3c.dom.Document; + +import org.apache.tuscany.spi.bootstrap.ComponentNames; +import org.apache.tuscany.spi.bootstrap.RuntimeComponent; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.TargetResolutionException; +import org.apache.tuscany.spi.deployer.Deployer; +import org.apache.tuscany.spi.wire.InboundWire; + +import org.apache.tuscany.core.implementation.composite.CompositeComponentImpl; + +/** + * The default implementation of the Tuscany runtime component + * + * @version $Rev$ $Date$ + */ +public class DefaultRuntime extends CompositeComponentImpl implements RuntimeComponent { + private CompositeComponent rootComponent; + private CompositeComponent systemComponent; + + /** + * Initialize a default runtime with an empty set of Property values. + */ + public DefaultRuntime() { + this(new HashMap()); + } + + /** + * Initialize a runtime with the a set of properties + * + * @param runtimeProperties Property values for the runtime itself + */ + public DefaultRuntime(Map runtimeProperties) { + super(ComponentNames.TUSCANY_RUNTIME, null, null, runtimeProperties); + } + + protected void setRootComponent(CompositeComponent rootComponent) { + this.rootComponent = rootComponent; + } + + protected void setSystemComponent(CompositeComponent systemComponent) { + this.systemComponent = systemComponent; + } + + public CompositeComponent getRootComponent() { + return rootComponent; + } + + public CompositeComponent getSystemComponent() { + return systemComponent; + } + + public Deployer getDeployer() throws TargetResolutionException { + InboundWire wire = systemComponent.resolveExternalAutowire(Deployer.class); + if (wire != null) { + return (Deployer) wire.getTargetService(); + } + return null; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultSCARuntime.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultSCARuntime.java new file mode 100644 index 0000000000..15172c60c0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultSCARuntime.java @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.bootstrap; + +import java.net.URI; +import java.net.URL; +import java.util.Arrays; +import java.util.List; + +import org.apache.tuscany.api.SCARuntime; +import org.apache.tuscany.api.TuscanyException; +import org.apache.tuscany.core.component.ComponentContextImpl; +import org.apache.tuscany.core.launcher.CompositeContextImpl; +import org.apache.tuscany.core.runtime.mini.SimpleRuntime; +import org.apache.tuscany.core.runtime.mini.SimpleRuntimeImpl; +import org.apache.tuscany.core.runtime.mini.SimpleRuntimeInfo; +import org.apache.tuscany.core.runtime.mini.SimpleRuntimeInfoImpl; +import org.apache.tuscany.spi.component.Component; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.TargetResolutionException; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.CurrentCompositeContext; +import org.osoa.sca.ServiceUnavailableException; + +/** + * Default implementation of SCARuntime. + * + * @version $Rev$ $Date$ + */ +@SuppressWarnings("deprecation") +public class DefaultSCARuntime extends SCARuntime { + protected CompositeComponent application; + protected CompositeContextImpl context; + + protected SimpleRuntime runtime; + + protected void startup(URL system, URL[] exts, URL applicationSCDL, String compositePath) throws Exception { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + List extensions = exts == null ? null : Arrays.asList(exts); + URI contributionURI = URI.create("/default"); + SimpleRuntimeInfo runtimeInfo = + new SimpleRuntimeInfoImpl(cl, system, extensions, contributionURI, applicationSCDL, compositePath); + runtime = new SimpleRuntimeImpl(runtimeInfo); + + try { + application = runtime.start(); + } catch (TuscanyException e) { + throw e; + } + + } + + protected void shutdown() throws Exception { + runtime.destroy(); + } + + @Override + protected ComponentContext getContext(String componentName) { + CompositeComponent composite = ((CompositeContextImpl)context).getComposite(); + Component component = (Component)composite.getChild(componentName); + return new ComponentContextImpl(CurrentCompositeContext.getContext(), component); + } + + public CompositeComponent getCompsiteComponent() { + return application; + } + + @Override + public Object getSystemService(String serviceName) { + try { + return runtime.getSystemService(Object.class, serviceName); + } catch (TargetResolutionException e) { + throw new ServiceUnavailableException(e); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java new file mode 100644 index 0000000000..2bb0524201 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java @@ -0,0 +1,293 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.builder; + +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +import org.apache.tuscany.core.binding.local.LocalBindingDefinition; +import org.apache.tuscany.core.implementation.composite.ReferenceImpl; +import org.apache.tuscany.core.implementation.composite.ServiceImpl; +import org.apache.tuscany.spi.QualifiedName; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.builder.BindingBuilder; +import org.apache.tuscany.spi.builder.BuilderException; +import org.apache.tuscany.spi.builder.BuilderRegistry; +import org.apache.tuscany.spi.builder.ComponentBuilder; +import org.apache.tuscany.spi.builder.GenericBuilder; +import org.apache.tuscany.spi.builder.MissingWireTargetException; +import org.apache.tuscany.spi.builder.ScopeNotFoundException; +import org.apache.tuscany.spi.component.AtomicComponent; +import org.apache.tuscany.spi.component.Component; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.Reference; +import org.apache.tuscany.spi.component.ReferenceBinding; +import org.apache.tuscany.spi.component.SCAObject; +import org.apache.tuscany.spi.component.ScopeContainer; +import org.apache.tuscany.spi.component.ScopeRegistry; +import org.apache.tuscany.spi.component.Service; +import org.apache.tuscany.spi.component.ServiceBinding; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.model.BindingDefinition; +import org.apache.tuscany.spi.model.ComponentDefinition; +import org.apache.tuscany.spi.model.ComponentType; +import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition; +import org.apache.tuscany.spi.model.Implementation; +import org.apache.tuscany.spi.model.InteractionScope; +import org.apache.tuscany.spi.model.ModelObject; +import org.apache.tuscany.spi.model.AbstractReferenceDefinition; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.model.ServiceDefinition; +import org.apache.tuscany.spi.wire.WireService; +import org.osoa.sca.annotations.EagerInit; + +/** + * The default builder registry in the runtime + * + * @version $Rev$ $Date$ + */ +@EagerInit +public class BuilderRegistryImpl implements BuilderRegistry { + protected WireService wireService; + protected ScopeRegistry scopeRegistry; + + private final Map>, ComponentBuilder>> componentBuilders = + new HashMap>, ComponentBuilder>>(); + private final Map, BindingBuilder> bindingBuilders = + new HashMap, BindingBuilder>(); + private final Map, GenericBuilder> genericBuilders = + new HashMap, GenericBuilder>(); + + public BuilderRegistryImpl(@Autowire + ScopeRegistry scopeRegistry, @Autowire + WireService wireService) { + this.scopeRegistry = scopeRegistry; + this.wireService = wireService; + } + + public > void register(Class implClass, ComponentBuilder builder) { + componentBuilders.put(implClass, builder); + } + + public > void unregisterComponentBuilder(Class implClass) { + componentBuilders.remove(implClass); + } + + public void register(Class implClass, BindingBuilder builder) { + bindingBuilders.put(implClass, builder); + } + + @SuppressWarnings("unchecked") + public > Component build(CompositeComponent parent, + ComponentDefinition componentDefinition, + DeploymentContext context) throws BuilderException { + + Class implClass = componentDefinition.getImplementation().getClass(); + // noinspection SuspiciousMethodCalls + ComponentBuilder componentBuilder = (ComponentBuilder)componentBuilders.get(implClass); + try { + if (componentBuilder == null) { + String name = implClass.getName(); + throw new NoRegisteredBuilderException("No builder registered for implementation", name); + } + + Component component = componentBuilder.build(parent, componentDefinition, context); + if (component != null) { + component.setDefaultPropertyValues(componentDefinition.getPropertyValues()); + Scope scope = componentDefinition.getImplementation().getComponentType().getImplementationScope(); + if (scope == Scope.SYSTEM || scope == Scope.COMPOSITE) { + component.setScopeContainer(context.getCompositeScope()); + } else { + // Check for conversational contract if conversational scope + if (scope == Scope.CONVERSATION) { + boolean hasConversationalContract = false; + ComponentType componentType = + componentDefinition.getImplementation().getComponentType(); + Map services = componentType.getServices(); + for (ServiceDefinition serviceDef : services.values()) { + InteractionScope intScope = serviceDef.getServiceContract().getInteractionScope(); + if (intScope == InteractionScope.CONVERSATIONAL) { + hasConversationalContract = true; + break; + } + } + if (!hasConversationalContract) { + Map references = componentType.getReferences(); + for (AbstractReferenceDefinition refDef : references.values()) { + // TODO check for a conversational callback + // contract + // refDef.getServiceContract() ... + } + } + if (!hasConversationalContract) { + String name = implClass.getName(); + throw new NoConversationalContractException("No conversational contract for conversational implementation", + name); + } + } + // Now it's ok to set the scope container + ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(scope); + if (scopeContainer == null) { + throw new ScopeNotFoundException(scope.toString()); + } + component.setScopeContainer(scopeContainer); + } + } + ComponentType componentType = componentDefinition.getImplementation().getComponentType(); + assert componentType != null : "Component type must be set"; + // create wires for the component + if (wireService != null && component instanceof AtomicComponent) { + wireService.createWires((AtomicComponent)component, componentDefinition); + } + // FIXME: Can we merge all the extensions at the component level? + buildExtensions(component, componentType, context); + buildExtensions(component, componentDefinition.getImplementation(), context); + buildExtensions(component, componentDefinition, context); + return component; + } catch (BuilderException e) { + e.addContextName(componentDefinition.getName()); + throw e; + } + } + + @SuppressWarnings({"unchecked"}) + public Service build(CompositeComponent parent, + ServiceDefinition serviceDefinition, + DeploymentContext deploymentContext) throws BuilderException { + String name = serviceDefinition.getName(); + ServiceContract serviceContract = serviceDefinition.getServiceContract(); + if (serviceDefinition.getBindings().isEmpty()) { + // if no bindings are configured, default to the local binding. + // this should be changed to allow runtime selection + if (serviceDefinition.getBindings().isEmpty()) { + // TODO JFM implement capability for the runtime to choose a + // binding + serviceDefinition.addBinding(new LocalBindingDefinition()); + } + } + boolean system = parent.isSystem(); + URI targetUri = serviceDefinition.getTarget(); + Service service = new ServiceImpl(name, parent, serviceContract, targetUri, system); + for (BindingDefinition definition : serviceDefinition.getBindings()) { + Class bindingClass = definition.getClass(); + // noinspection SuspiciousMethodCalls + BindingBuilder bindingBuilder = bindingBuilders.get(bindingClass); + if (bindingBuilder == null) { + throw new NoRegisteredBuilderException("No builder registered for type", bindingClass.getName()); + } + ServiceBinding binding = bindingBuilder.build(parent, serviceDefinition, definition, deploymentContext); + if (wireService != null) { + URI uri = serviceDefinition.getTarget(); + if (uri == null) { + throw new MissingWireTargetException("Service uri not specified"); + } + String path = uri.getPath(); + ServiceContract contract = serviceDefinition.getServiceContract(); + wireService.createWires(binding, contract, path); + } + buildExtensions(binding, definition, deploymentContext); + service.addServiceBinding(binding); + } + buildExtensions(service, serviceDefinition, deploymentContext); + return service; + } + + @SuppressWarnings("unchecked") + public Reference build(CompositeComponent parent, + AbstractReferenceDefinition referenceDefinition, + DeploymentContext context) + throws BuilderException { + String name = referenceDefinition.getName(); + ServiceContract contract = referenceDefinition.getServiceContract(); + if (referenceDefinition.getBindings().isEmpty()) { + // if no bindings are configured, default to the local binding. + // this should be changed to allow runtime selection + if (referenceDefinition.getBindings().isEmpty()) { + // TODO JFM implement capability for the runtime to choose a + // binding + referenceDefinition.addBinding(new LocalBindingDefinition()); + } + } + + Reference reference = new ReferenceImpl(name, parent, contract); + for (BindingDefinition bindingDefinition : referenceDefinition.getBindings()) { + Class bindingClass = bindingDefinition.getClass(); + // noinspection SuspiciousMethodCalls + BindingBuilder bindingBuilder = bindingBuilders.get(bindingClass); + ReferenceBinding binding = bindingBuilder.build(parent, referenceDefinition, bindingDefinition, context); + // create wires for the component + if (wireService != null) { + URI targetUri = bindingDefinition.getTargetUri(); + // it is possible for a binding to not have a URI + QualifiedName targetName = null; + if (targetUri != null) { + targetName = new QualifiedName(targetUri.getPath()); + } + wireService.createWires(binding, contract, targetName); + + } + buildExtensions(binding, bindingDefinition, context); + reference.addReferenceBinding(binding); + + } + buildExtensions(reference, referenceDefinition, context); + return reference; + } + + @SuppressWarnings("unchecked") + public SCAObject build(SCAObject parent, ModelObject modelObject, DeploymentContext context) + throws BuilderException { + if (modelObject != null) { + GenericBuilder builder = genericBuilders.get(modelObject.getClass()); + if (builder != null) { + return builder.build(parent, modelObject, context); + } + } + return null; + } + + // We need to include all the extensions from the include + private void buildExtensions(SCAObject parent, ModelObject model, DeploymentContext deploymentContext) + throws BuilderException { + for (Object o : model.getExtensions().values()) { + if (o instanceof ModelObject) { + SCAObject scaObject = build(parent, (ModelObject)o, deploymentContext); + if (scaObject != null) { + parent.getExtensions().put(scaObject.getName(), scaObject); + } + } + } + } + + public void register(Class modelClass, + GenericBuilder builder) { + genericBuilders.put(modelClass, builder); + } + + public void unregisterBindingBuilder(Class implClass) { + bindingBuilders.remove(implClass); + } + + public void unregisterGenericBuilder(Class modelClass) { + genericBuilders.remove(modelClass); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java new file mode 100644 index 0000000000..728b0b8fc9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java @@ -0,0 +1,627 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.builder; + +import java.util.List; +import java.util.Map; + +import org.osoa.sca.annotations.Constructor; + +import org.apache.tuscany.spi.QualifiedName; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.builder.Connector; +import org.apache.tuscany.spi.builder.MissingWireTargetException; +import org.apache.tuscany.spi.builder.WiringException; +import org.apache.tuscany.spi.component.Component; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.Reference; +import org.apache.tuscany.spi.component.ReferenceBinding; +import org.apache.tuscany.spi.component.SCAObject; +import org.apache.tuscany.spi.component.Service; +import org.apache.tuscany.spi.component.ServiceBinding; +import org.apache.tuscany.spi.component.TargetInvokerCreationException; +import org.apache.tuscany.spi.component.TargetResolutionException; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.idl.java.JavaServiceContract; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.services.work.WorkScheduler; +import org.apache.tuscany.spi.wire.InboundInvocationChain; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.IncompatibleServiceContractException; +import org.apache.tuscany.spi.wire.Interceptor; +import org.apache.tuscany.spi.wire.OutboundInvocationChain; +import org.apache.tuscany.spi.wire.OutboundWire; +import org.apache.tuscany.spi.wire.TargetInvoker; +import org.apache.tuscany.spi.wire.WirePostProcessorRegistry; +import org.apache.tuscany.spi.wire.WireService; + +import org.apache.tuscany.core.wire.LoopBackWire; +import org.apache.tuscany.core.wire.NonBlockingBridgingInterceptor; +import org.apache.tuscany.core.wire.SynchronousBridgingInterceptor; +import org.apache.tuscany.core.wire.WireUtils; + +/** + * The default connector implmentation + * + * @version $$Rev$$ $$Date$$ + */ +public class ConnectorImpl implements Connector { + private WirePostProcessorRegistry postProcessorRegistry; + private WireService wireService; + private WorkContext workContext; + private WorkScheduler scheduler; + + public ConnectorImpl() { + } + + @Constructor + public ConnectorImpl(@Autowire WireService wireService, + @Autowire WirePostProcessorRegistry processorRegistry, + @Autowire WorkScheduler scheduler, + @Autowire WorkContext workContext) { + this.postProcessorRegistry = processorRegistry; + this.wireService = wireService; + this.scheduler = scheduler; + this.workContext = workContext; + } + + public void connect(SCAObject source) throws WiringException { + if (source instanceof Component) { + handleComponent((Component) source); + } else if (source instanceof Reference) { + handleReference((Reference) source); + } else if (source instanceof Service) { + handleService((Service) source); + } else { + throw new AssertionError("Invalid source type"); + } + } + + public void connect(InboundWire sourceWire, OutboundWire targetWire, boolean optimizable) + throws WiringException { + Map, OutboundInvocationChain> targetChains = targetWire.getInvocationChains(); + if (sourceWire.getContainer() != null && sourceWire.getContainer().isSystem()) { + sourceWire.setTargetWire(targetWire); + // system services do not need to have their chains processed, return + return; + } + for (InboundInvocationChain inboundChain : sourceWire.getInvocationChains().values()) { + // match invocation chains + OutboundInvocationChain outboundChain = targetChains.get(inboundChain.getOperation()); + if (outboundChain == null) { + throw new IncompatibleInterfacesException(sourceWire, targetWire); + } + connect(inboundChain, outboundChain); + } + if (postProcessorRegistry != null) { + // run wire post-processors + postProcessorRegistry.process(sourceWire, targetWire); + } + if (optimizable && WireUtils.isOptimizable(sourceWire) && WireUtils.isOptimizable(targetWire)) { + sourceWire.setOptimizable(true); + sourceWire.setTargetWire(targetWire); + } + } + + /** + * Connects the source outbound wire to a corresponding target inbound wire + * + * @param sourceWire the source wire to connect + * @param targetWire the target wire to connect to + * @param optimizable true if the wire connection can be optimized + * @throws WiringException + */ + public void connect(OutboundWire sourceWire, InboundWire targetWire, boolean optimizable) + throws WiringException { + SCAObject source = sourceWire.getContainer(); + assert source != null; + SCAObject target = targetWire.getContainer(); + assert target != null; + Map, InboundInvocationChain> targetChains = targetWire.getInvocationChains(); + if (sourceWire.getContainer() != null && sourceWire.getContainer().isSystem()) { + sourceWire.setTargetWire(targetWire); + // system services do not need to have their chains processed, return + return; + } + + // FIXME: [rfeng] The targetWire is provided by the system + if (targetWire.getContainer() != null && targetWire.getContainer().isSystem()) { + sourceWire.setOptimizable(true); + sourceWire.setTargetWire(targetWire); + // system services do not need to have their chains processed, return + return; + } + + // match outbound to inbound chains + for (OutboundInvocationChain outboundChain : sourceWire.getInvocationChains().values()) { + Operation operation = outboundChain.getOperation(); + + // TODO: TUSCANY-1111, can't use targetChains.get with different IDLs so use simple name matching + // InboundInvocationChain inboundChain = targetChains.get(operation); + InboundInvocationChain inboundChain = null; // = targetChains.get(operation); + for (InboundInvocationChain ic: targetChains.values()) { + if (ic.getOperation().equals(operation)) { + inboundChain = ic; + break; + } + } + if (inboundChain == null) { + throw new IncompatibleInterfacesException(sourceWire, targetWire); + } + Operation inboundOperation = inboundChain.getOperation(); + boolean isOneWayOperation = operation.isNonBlocking(); + TargetInvoker invoker; + if (target instanceof Component) { + Component component = (Component) target; + QualifiedName wireTargetName = sourceWire.getTargetName(); + String portName = null; + if (wireTargetName != null) { + portName = wireTargetName.getPortName(); + } + try { + invoker = component.createTargetInvoker(portName, inboundOperation, targetWire); + } catch (TargetInvokerCreationException e) { + throw new WireConnectException("Error connecting source and target", sourceWire, targetWire, e); + } + } else if (target instanceof ReferenceBinding) { + ReferenceBinding referenceBinding = (ReferenceBinding) target; + try { + invoker = referenceBinding.createTargetInvoker(targetWire.getServiceContract(), inboundOperation); + } catch (TargetInvokerCreationException e) { + String targetName = targetWire.getContainer().getName(); + throw new WireConnectException("Error processing inbound wire", null, null, targetName, null, e); + } + } else if (target instanceof ServiceBinding) { + ServiceBinding binding = (ServiceBinding) target; + try { + invoker = binding.createTargetInvoker(targetWire.getServiceContract(), inboundChain.getOperation()); + } catch (TargetInvokerCreationException e) { + String targetName = targetWire.getContainer().getName(); + throw new WireConnectException("Error processing inbound wire", null, null, targetName, null, e); + } + } else { + throw new AssertionError(); + } + + if (source instanceof ServiceBinding) { + // services are a special case: invoker must go on the inbound and outbound chains + if (target instanceof Component && isOneWayOperation) { + // if the target is a component and the operation is non-blocking + connect(outboundChain, inboundChain, invoker, true); + } else { + connect(outboundChain, inboundChain, invoker, false); + } + ServiceBinding binding = (ServiceBinding) source; + InboundInvocationChain chain = binding.getInboundWire().getInvocationChains().get(operation); + chain.setTargetInvoker(invoker); + } else { + if (target instanceof Component && isOneWayOperation) { + // if the target is a component and the operation is non-blocking + connect(outboundChain, inboundChain, invoker, true); + } else { + connect(outboundChain, inboundChain, invoker, false); + } + } + } + + // create source callback chains and connect them if target callback chains exist + Map, OutboundInvocationChain> sourceCallbackChains = + targetWire.getSourceCallbackInvocationChains(source.getName()); + for (InboundInvocationChain inboundChain : sourceWire.getTargetCallbackInvocationChains().values()) { + Operation operation = inboundChain.getOperation(); + if (sourceCallbackChains != null && sourceCallbackChains.get(operation) != null) { + String opName = operation.getName(); + throw new IllegalCallbackException("Source callback chain should not exist for operation", + opName, + sourceWire, + targetWire); + } + + ServiceContract targetContract = targetWire.getServiceContract(); + assert targetContract != null; + String opName = operation.getName(); + assert opName != null; + Operation targetOp = targetContract.getCallbackOperations().get(opName); + OutboundInvocationChain outboundChain = wireService.createOutboundChain(targetOp); + targetWire.addSourceCallbackInvocationChain(source.getName(), targetOp, outboundChain); + if (source instanceof Component) { + Component component = (Component) source; + TargetInvoker invoker; + try { + invoker = component.createTargetInvoker(targetOp.getName(), operation, null); + } catch (TargetInvokerCreationException e) { + throw new WireConnectException("Error connecting source and target", sourceWire, targetWire, e); + } + boolean isOneWayOperation = targetOp.isNonBlocking(); + if (target instanceof Component && isOneWayOperation) { + // if the target is a component and the operation is non-blocking + connect(outboundChain, inboundChain, invoker, true); + } else { + connect(outboundChain, inboundChain, invoker, false); + } + } else if (source instanceof ReferenceBinding) { + ReferenceBinding binding = (ReferenceBinding) source; + ServiceContract sourceContract = sourceWire.getServiceContract(); + TargetInvoker invoker; + try { + invoker = binding.createTargetInvoker(sourceContract, operation); + } catch (TargetInvokerCreationException e) { + throw new WireConnectException("Error connecting source and target", sourceWire, targetWire, e); + } + connect(outboundChain, inboundChain, invoker, false); + } else if (source instanceof ServiceBinding) { + ServiceBinding binding = (ServiceBinding) source; + ServiceContract sourceContract = sourceWire.getServiceContract(); + TargetInvoker invoker; + try { + invoker = binding.createTargetInvoker(sourceContract, operation); + } catch (TargetInvokerCreationException e) { + String targetName = sourceWire.getContainer().getName(); + throw new WireConnectException("Error processing callback wire", null, null, targetName, null, e); + } + connect(outboundChain, inboundChain, invoker, false); + } else { + throw new AssertionError(); + } + } + if (postProcessorRegistry != null) { + // run wire post-processors + postProcessorRegistry.process(sourceWire, targetWire); + } + // perform optimization, if possible + if (optimizable && WireUtils.isOptimizable(sourceWire) && WireUtils.isOptimizable(targetWire)) { + sourceWire.setOptimizable(true); + sourceWire.setTargetWire(targetWire); + } + } + + /** + * Connects a source to target chain + * + * @param sourceChain the source chain + * @param targetChain the target chain + * @param invoker the invoker to place on the source chain for dispatching invocations + * @param nonBlocking true if the operation is non-blocking + */ + protected void connect(OutboundInvocationChain sourceChain, + InboundInvocationChain targetChain, + TargetInvoker invoker, + boolean nonBlocking) throws WireConnectException { + Interceptor head = targetChain.getHeadInterceptor(); + if (head == null) { + throw new WireConnectException("Inbound chain must contain at least one interceptor"); + } + if (nonBlocking) { + sourceChain.setTargetInterceptor(new NonBlockingBridgingInterceptor(scheduler, workContext, head)); + } else { + sourceChain.setTargetInterceptor(new SynchronousBridgingInterceptor(head)); + } + sourceChain.prepare(); + sourceChain.setTargetInvoker(invoker); + } + + + /** + * Connects an inbound source chain to an outbound target chain + * + * @param sourceChain the source chain to connect + * @param targetChain the target chain to connect + */ + protected void connect(InboundInvocationChain sourceChain, OutboundInvocationChain targetChain) + throws WireConnectException { + Interceptor head = targetChain.getHeadInterceptor(); + if (head == null) { + throw new WireConnectException("Outbound chain must contain at least one interceptor"); + } + // invocations from inbound to outbound chains are always synchronous as they occur in services and references + sourceChain.addInterceptor(new SynchronousBridgingInterceptor(head)); + } + + /** + * Connects an outbound wire to its target in a composite. + * + * @param sourceWire the source wire to connect + * @throws WiringException + */ + protected void connect(SCAObject source, OutboundWire sourceWire, SCAObject target) throws WiringException { + assert sourceWire.getTargetName() != null; + QualifiedName targetName = sourceWire.getTargetName(); + if (target instanceof Component) { + connect(source, sourceWire, (Component) target); + } else if (target instanceof Reference) { + connect(source, sourceWire, (Reference) target); + } else if (target instanceof Service) { + connect(source, sourceWire, (Service) target); + } else if (target == null) { + String sourceName = sourceWire.getContainer().getName(); + String sourceReference = sourceWire.getReferenceName(); + throw new TargetServiceNotFoundException("Target service not found", + sourceName, + sourceReference, + targetName.getPartName(), + targetName.getPortName()); + } else { + String sourceName = sourceWire.getContainer().getName(); + String sourceRef = sourceWire.getReferenceName(); + String partName = targetName.getPartName(); + String portName = targetName.getPortName(); + throw new InvalidTargetTypeException("Invalid target type", sourceName, sourceRef, partName, portName); + } + } + + protected void connect(SCAObject source, OutboundWire sourceWire, Reference target) throws WiringException { + assert sourceWire.getTargetName() != null; + QualifiedName targetName = sourceWire.getTargetName(); + InboundWire targetWire = null; + for (ReferenceBinding binding : target.getReferenceBindings()) { + InboundWire candidate = binding.getInboundWire(); + if (sourceWire.getBindingType().equals(candidate.getBindingType())) { + targetWire = candidate; + break; + } + } + if (targetWire == null) { + if (target.getReferenceBindings().size() > 0 && source instanceof Component) { + // TODO create a pluggable algorithm for selecting the binding type + targetWire = target.getReferenceBindings().get(0).getInboundWire(); + } + if (targetWire == null) { + throw new NoCompatibleBindingsException(source.getName(), + targetName.getPartName(), + targetName.getPortName()); + } + } + checkIfWireable(sourceWire, targetWire); + boolean optimizable = isOptimizable(source.getScope(), target.getScope()); + connect(sourceWire, targetWire, optimizable); + } + + protected void connect(SCAObject source, OutboundWire sourceWire, Service target) throws WiringException { + assert sourceWire.getTargetName() != null; + QualifiedName targetName = sourceWire.getTargetName(); + InboundWire targetWire = null; + for (ServiceBinding binding : target.getServiceBindings()) { + InboundWire candidate = binding.getInboundWire(); + if (sourceWire.getBindingType().equals(candidate.getBindingType())) { + targetWire = candidate; + break; + } + } + if (targetWire == null) { + throw new NoCompatibleBindingsException(source.getName(), + targetName.getPartName(), + targetName.getPortName()); + } + checkIfWireable(sourceWire, targetWire); + boolean optimizable = isOptimizable(source.getScope(), target.getScope()); + connect(sourceWire, targetWire, optimizable); + } + + protected void connect(SCAObject source, OutboundWire sourceWire, Component target) + throws WiringException { + assert sourceWire.getTargetName() != null; + QualifiedName targetName = sourceWire.getTargetName(); + InboundWire targetWire; + // FIXME JFM should we move getInboundSystemWire up to Component? + if (target instanceof CompositeComponent && source.isSystem()) { + targetWire = ((CompositeComponent) target).getInboundSystemWire(targetName.getPortName()); + } else { + targetWire = target.getInboundWire(targetName.getPortName()); + } + if (targetWire == null) { + String sourceName = sourceWire.getContainer().getName(); + String sourceReference = sourceWire.getReferenceName(); + throw new TargetServiceNotFoundException("Target service does not exist or is not configured with a " + + "local binding", + sourceName, + sourceReference, + targetName.getPartName(), + targetName.getPortName()); + } + checkIfWireable(sourceWire, targetWire); + boolean optimizable = isOptimizable(source.getScope(), target.getScope()); + connect(sourceWire, targetWire, optimizable); + } + + protected void autowire(OutboundWire outboundWire, CompositeComponent parent) + throws WiringException { + // JFM FIXME test coverage for this method + InboundWire targetWire; + try { + Class interfaze = outboundWire.getServiceContract().getInterfaceClass(); + if (CompositeComponent.class.equals(interfaze)) { + JavaServiceContract contract = new JavaServiceContract(CompositeComponent.class); + targetWire = new LoopBackWire(); + targetWire.setServiceContract(contract); + targetWire.setContainer(parent); + outboundWire.setTargetWire(targetWire); + return; + } + if (outboundWire.getContainer().isSystem()) { + targetWire = parent.resolveSystemAutowire(interfaze); + } else { + targetWire = parent.resolveAutowire(interfaze); + } + } catch (TargetResolutionException e) { + String sourceReference = outboundWire.getReferenceName(); + String sourceName = outboundWire.getContainer().getName(); + throw new WireConnectException("Error resolving autowire target", + sourceName, + sourceReference, + null, + null, + e); + } + if (targetWire == null) { + // autowire may return null if it is optional. The client must decide if an error should be thrown + return; + } + Scope sourceScope = outboundWire.getContainer().getScope(); + Scope targetScope = targetWire.getContainer().getScope(); + boolean optimizable = isOptimizable(sourceScope, targetScope); + connect(outboundWire, targetWire, optimizable); + } + + protected void checkIfWireable(OutboundWire sourceWire, InboundWire targetWire) + throws IncompatibleInterfacesException { + if (wireService == null) { + Class sourceInterface = sourceWire.getServiceContract().getInterfaceClass(); + Class targetInterface = targetWire.getServiceContract().getInterfaceClass(); + if (!sourceInterface.isAssignableFrom(targetInterface)) { + throw new IncompatibleInterfacesException(sourceWire, targetWire); + } + } else { + try { + ServiceContract sourceContract = sourceWire.getServiceContract(); + ServiceContract targetContract = targetWire.getServiceContract(); + wireService.checkCompatibility(sourceContract, targetContract, false); + } catch (IncompatibleServiceContractException e) { + throw new IncompatibleInterfacesException(sourceWire, targetWire, e); + } + } + } + + protected boolean isOptimizable(Scope pReferrer, Scope pReferee) { + if (pReferrer == Scope.UNDEFINED + || pReferee == Scope.UNDEFINED + || pReferrer == Scope.CONVERSATION + || pReferee == Scope.CONVERSATION) { + return false; + } + if (pReferee == pReferrer) { + return true; + } else if (pReferrer == Scope.STATELESS) { + return true; + } else if (pReferee == Scope.STATELESS) { + return false; + } else if (pReferrer == Scope.REQUEST && pReferee == Scope.SESSION) { + return true; + } else if (pReferrer == Scope.REQUEST && pReferee == Scope.COMPOSITE) { + return true; + } else if (pReferrer == Scope.REQUEST && pReferee == Scope.SYSTEM) { + return true; + } else if (pReferrer == Scope.SESSION && pReferee == Scope.COMPOSITE) { + return true; + } else if (pReferrer == Scope.SESSION && pReferee == Scope.SYSTEM) { + return true; + } else //noinspection SimplifiableIfStatement + if (pReferrer == Scope.SYSTEM && pReferee == Scope.COMPOSITE) { + // case where a service context points to a composite scoped component + return true; + } else { + return pReferrer == Scope.COMPOSITE && pReferee == Scope.SYSTEM; + } + } + + /** + * Connects wires from a service to a target + * + * @param service the service + * @throws WiringException if an exception connecting the service wires is encountered + */ + private void handleService(Service service) throws WiringException { + CompositeComponent parent = service.getParent(); + assert parent != null; + for (ServiceBinding binding : service.getServiceBindings()) { + InboundWire inboundWire = binding.getInboundWire(); + OutboundWire outboundWire = binding.getOutboundWire(); + // For a composite reference only, since its outbound wire comes from its parent composite, + // the corresponding target would not lie in its parent but rather in its parent's parent + SCAObject target; + if (service.isSystem()) { + target = parent.getSystemChild(outboundWire.getTargetName().getPartName()); + } else { + target = parent.getChild(outboundWire.getTargetName().getPartName()); + } + // connect the outbound service wire to the target + connect(binding, outboundWire, target); + // NB: this connect must be done after the outbound service chain is connected to its target above + connect(inboundWire, outboundWire, true); + } + } + + private void handleReference(Reference reference) throws WiringException { + CompositeComponent parent = reference.getParent(); + assert parent != null; + for (ReferenceBinding binding : reference.getReferenceBindings()) { + InboundWire inboundWire = binding.getInboundWire(); + Map, InboundInvocationChain> inboundChains = inboundWire.getInvocationChains(); + for (InboundInvocationChain chain : inboundChains.values()) { + // add target invoker on inbound side + ServiceContract contract = inboundWire.getServiceContract(); + Operation operation = chain.getOperation(); + TargetInvoker invoker; + try { + invoker = binding.createTargetInvoker(contract, operation); + } catch (TargetInvokerCreationException e) { + String targetName = inboundWire.getContainer().getName(); + throw new WireConnectException("Error processing inbound wire", + null, + null, + targetName, + null, + e); + } + chain.setTargetInvoker(invoker); + chain.prepare(); + } + OutboundWire outboundWire = binding.getOutboundWire(); + // connect the reference's inbound and outbound wires + connect(inboundWire, outboundWire, true); + } + } + + private void handleComponent(Component component) throws WiringException { + CompositeComponent parent = component.getParent(); + assert parent != null; + // connect outbound wires for component references to their targets + for (List referenceWires : component.getOutboundWires().values()) { + for (OutboundWire outboundWire : referenceWires) { + try { + if (component.isSystem()) { + if (outboundWire.isAutowire()) { + autowire(outboundWire, parent); + + } else { + SCAObject target = parent.getSystemChild(outboundWire.getTargetName().getPartName()); + connect(component, outboundWire, target); + } + } else { + if (outboundWire.isAutowire()) { + autowire(outboundWire, parent); + } else { + if (outboundWire.getTargetName() == null) { + String referenceName = outboundWire.getReferenceName(); + throw new MissingWireTargetException("Target name was null", referenceName); + } + SCAObject target = parent.getChild(outboundWire.getTargetName().getPartName()); + connect(component, outboundWire, target); + } + } + } catch (WiringException e) { + e.addContextName(component.getName()); + e.addContextName(parent.getName()); + throw e; + } + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IllegalCallbackException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IllegalCallbackException.java new file mode 100644 index 0000000000..5ca843e198 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IllegalCallbackException.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.spi.builder.WiringException; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.OutboundWire; + +/** + * Denotes an illegal callback + * + * @version $Rev$ $Date$ + */ +public class IllegalCallbackException extends WiringException { + + public IllegalCallbackException(String message, + String identifier, + String sourceName, + String referenceName, + String targetName, + String serviceName) { + super(message, identifier); + setSourceName(sourceName); + setReferenceName(referenceName); + setTargetName(targetName); + setTargetServiceName(serviceName); + } + + + public IllegalCallbackException(String message, String identifier, OutboundWire source, InboundWire target) { + super(message, identifier); + setSourceName(source.getContainer().getName()); + setReferenceName(source.getReferenceName()); + setTargetName(target.getContainer().getName()); + setTargetServiceName(target.getServiceName()); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java new file mode 100644 index 0000000000..4b94983c34 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.spi.builder.WiringException; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.OutboundWire; + +/** + * Denotes an attempt to wire incompatible interfaces + * + * @version $Rev$ $Date$ + */ +public class IncompatibleInterfacesException extends WiringException { + + + public IncompatibleInterfacesException(String message, + String sourceName, + String referenceName, + String targetName, + String targetServiceName) { + super(message); + setSourceName(sourceName); + setReferenceName(referenceName); + setTargetName(targetName); + setTargetServiceName(targetServiceName); + } + + public IncompatibleInterfacesException(String message, String sourceName, + String referenceName, + String targetName, + String serviceName, + Throwable cause) { + super(message, cause); + setSourceName(sourceName); + setReferenceName(referenceName); + setTargetName(targetName); + setTargetServiceName(serviceName); + } + + public IncompatibleInterfacesException(InboundWire source, OutboundWire target) { + super("Incompatible source and target interfaces"); + setTargetServiceName(source.getServiceName()); + if (source.getContainer() != null) { + setSourceName(source.getContainer().getName()); + } + setReferenceName(target.getReferenceName()); + if (target.getContainer() != null) { + setTargetName(target.getContainer().getName()); + } + } + + public IncompatibleInterfacesException(OutboundWire source, InboundWire target) { + super("Incompatible source and target interfaces"); + setTargetServiceName(target.getServiceName()); + if (source.getContainer() != null) { + setSourceName(source.getContainer().getName()); + } + setReferenceName(source.getReferenceName()); + if (target.getContainer() != null) { + setTargetName(target.getContainer().getName()); + } + } + + public IncompatibleInterfacesException(OutboundWire source, InboundWire target, Throwable throwable) { + super("Incompatible source and target interfaces", throwable); + setTargetServiceName(target.getServiceName()); + if (source.getContainer() != null) { + setSourceName(source.getContainer().getName()); + } + setReferenceName(source.getReferenceName()); + if (target.getContainer() != null) { + setTargetName(target.getContainer().getName()); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/InvalidTargetTypeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/InvalidTargetTypeException.java new file mode 100644 index 0000000000..e96fb764a0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/InvalidTargetTypeException.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.spi.builder.WiringException; + +/** + * Denotes an invalid target service for a wire + * + * @version $Rev$ $Date$ + */ +public class InvalidTargetTypeException extends WiringException { + + public InvalidTargetTypeException(String message, + String sourceName, + String referenceName, + String targetName, + String serviceName) { + super(message); + setSourceName(sourceName); + setReferenceName(referenceName); + setTargetName(targetName); + setTargetServiceName(serviceName); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoCompatibleBindingsException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoCompatibleBindingsException.java new file mode 100644 index 0000000000..620fbf6694 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoCompatibleBindingsException.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.spi.builder.WiringException; + +/** + * @version $Rev$ $Date$ + */ +public class NoCompatibleBindingsException extends WiringException { + public NoCompatibleBindingsException(String sourceName, + String targetName, + String serviceName) { + super("No compatible bindings for source and target"); + setSourceName(sourceName); + setTargetName(targetName); + setTargetServiceName(serviceName); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoConversationalContractException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoConversationalContractException.java new file mode 100644 index 0000000000..71eb9ebd26 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoConversationalContractException.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.spi.builder.BuilderException; + +/** + * Raised when a component has conversational scope but no conversational contract + * + * @version $Rev: 487877 $ $Date: 2006-12-16 15:32:16 -0500 (Sat, 16 Dec 2006) $ + */ +public class NoConversationalContractException extends BuilderException { + + public NoConversationalContractException(String message, String identifier) { + super(message, identifier); + } + + public NoConversationalContractException(String message) { + super(message); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoRegisteredBuilderException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoRegisteredBuilderException.java new file mode 100644 index 0000000000..340a20f239 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoRegisteredBuilderException.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.spi.builder.BuilderException; + +/** + * Raised when a builder cannot be found for a SCDL entry type + * + * @version $Rev$ $Date$ + */ +public class NoRegisteredBuilderException extends BuilderException { + + public NoRegisteredBuilderException(String message, String identifier) { + super(message, identifier); + } + + public NoRegisteredBuilderException(String message) { + super(message); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/TargetServiceNotFoundException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/TargetServiceNotFoundException.java new file mode 100644 index 0000000000..873bf619b0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/TargetServiceNotFoundException.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.spi.builder.WiringException; + +/** + * Indicates the target service of a reference was not found + * + * @version $Rev$ $Date$ + */ +public class TargetServiceNotFoundException extends WiringException { + + public TargetServiceNotFoundException(String message, + String sourceName, + String referenceName, + String targetName, + String serviceName) { + super(message); + setSourceName(sourceName); + setReferenceName(referenceName); + setTargetName(targetName); + setTargetServiceName(serviceName); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WireConnectException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WireConnectException.java new file mode 100644 index 0000000000..89105d27b4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WireConnectException.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.spi.builder.WiringException; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.OutboundWire; + +/** + * Denotes a general error connecting two wires + * + * @version $Rev$ $Date$ + */ +public class WireConnectException extends WiringException { + + public WireConnectException(String message) { + super(message); + } + + public WireConnectException(String message, + String sourceName, + String referenceName, + String targetName, + String serviceName, + Throwable throwable) { + super(message, throwable); + setSourceName(sourceName); + setReferenceName(referenceName); + setTargetName(targetName); + setTargetServiceName(serviceName); + } + + + public WireConnectException(String message, OutboundWire source, InboundWire target, Throwable throwable) { + super(message, throwable); + setSourceName(source.getContainer().getName()); + setReferenceName(source.getReferenceName()); + setTargetName(target.getContainer().getName()); + setTargetServiceName(target.getServiceName()); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java new file mode 100644 index 0000000000..3bc617066a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.builder; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.spi.wire.WirePostProcessor; +import org.apache.tuscany.spi.wire.WirePostProcessorRegistry; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.OutboundWire; + +/** + * The default implementation of a WirePostProcessor + * + * @version $Rev$ $Date$ + */ +public class WirePostProcessorRegistryImpl implements WirePostProcessorRegistry { + + private final List processors = new ArrayList(); + + public void process(OutboundWire source, InboundWire target) { + for (WirePostProcessor processor : processors) { + processor.process(source, target); + } + } + + public void process(InboundWire source, OutboundWire target) { + for (WirePostProcessor processor : processors) { + processor.process(source, target); + } + } + + public void register(WirePostProcessor processor) { + processors.add(processor); + } + + public void unregister(WirePostProcessor processor) { + processors.remove(processor); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WiringExceptionFormatter.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WiringExceptionFormatter.java new file mode 100644 index 0000000000..16cf27048a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WiringExceptionFormatter.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.builder; + +import java.io.PrintWriter; + +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.EagerInit; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.builder.WiringException; + +import org.apache.tuscany.host.monitor.ExceptionFormatter; +import org.apache.tuscany.host.monitor.FormatterRegistry; + +/** + * Formats {@link WiringException}s + * + * @version $Rev$ $Date$ + */ +@EagerInit +public class WiringExceptionFormatter implements ExceptionFormatter { + private FormatterRegistry factory; + + public WiringExceptionFormatter(@Autowire FormatterRegistry factory) { + this.factory = factory; + factory.register(this); + } + + public boolean canFormat(Class type) { + return WiringException.class.isAssignableFrom(type); + } + + @Destroy + public void destroy() { + factory.unregister(this); + } + + public PrintWriter write(PrintWriter writer, Throwable exception) { + assert exception instanceof WiringException; + WiringException e = (WiringException) exception; + e.appendBaseMessage(writer); + if (e.getSourceName() != null && e.getReferenceName() != null) { + writer.write("\nSource : " + e.getSourceName() + "/" + e.getReferenceName()); + } else if (e.getSourceName() != null) { + writer.write("\nSource : " + e.getSourceName()); + } + if (e.getTargetName() != null && e.getTargetServiceName() != null) { + writer.write("\nTarget : " + e.getTargetName() + "/" + e.getTargetServiceName()); + } else if (e.getTargetName() != null) { + writer.write("\nTarget : " + e.getTargetName()); + } + e.appendContextStack(writer).append("\n"); + return writer; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java new file mode 100644 index 0000000000..6cc06d7646 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component; + +import java.net.URI; + +import org.osoa.sca.CallableReference; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.RequestContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.ServiceRuntimeException; + +import org.apache.tuscany.api.TuscanyRuntimeException; +import org.apache.tuscany.spi.component.Component; + +/** + * + * @version $Rev$ $Date$ + */ +public class ComponentContextImpl implements ComponentContext { + private final CompositeContext context; + private final Component component; + + public ComponentContextImpl(CompositeContext context, Component component) { + this.component = component; + this.context = context; + } + + public String getURI() { + try { + return component.getName(); + } catch (TuscanyRuntimeException e) { + throw new ServiceRuntimeException(e.getMessage(), e); + } + } + + public > R cast(B target) throws IllegalArgumentException { + throw new UnsupportedOperationException(); + } + + public B getService(Class businessInterface, String referenceName) { + try { + return context.locateService(businessInterface, component.getName() + "/" + referenceName); + } catch (TuscanyRuntimeException e) { + throw new ServiceRuntimeException(e.getMessage(), e); + } + } + + public ServiceReference getServiceReference(Class businessInterface, String referenceName) { + throw new UnsupportedOperationException(); + } + + public B getProperty(Class type, String propertyName) { + throw new UnsupportedOperationException(); + } + + public ServiceReference createSelfReference(Class businessInterface) { + return null; + } + + public ServiceReference createSelfReference(Class businessInterface, String serviceName) { + return null; + } + + public RequestContext getRequestContext() { + return context.getRequestContext(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ScopeIdentifier.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ScopeIdentifier.java new file mode 100644 index 0000000000..35125b85ef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ScopeIdentifier.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component; + +/** + * Implementations enable lazy retrieval of a scope id associated with a request, i.e. an id (and presumably a context) + * do not have to be generated if the scope is never accessed. Identifiers are associated with the current request + * thread and keyed on scope type. + * + * @version $Rev$ $Date$ + * @see org.apache.tuscany.spi.component.WorkContext + */ +public interface ScopeIdentifier { + + /** + * Returns the scope id for the request. + */ + Object getIdentifier(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java new file mode 100644 index 0000000000..8d2afc35d9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java @@ -0,0 +1,211 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component; + +import java.util.ArrayList; +import java.util.IdentityHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.spi.component.AtomicComponent; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.WorkContext; + +/** + * An implementation of an {@link org.apache.tuscany.spi.component.WorkContext} that handles event-to-thread + * associations using an InheritableThreadLocal + * + * @version $Rev$ $Date$ + */ +public class WorkContextImpl implements WorkContext { + private static final Object REMOTE_CONTEXT = new Object(); + private static final Object CORRELATION_ID = new Object(); + private static final Object CALLBACK_ROUTING_CHAIN = new Object(); + private static final Object CURRENT_ATOMIC = new Object(); + private static final Object CURRENT_SERVICE_NAMES = new Object(); + + // [rfeng] We cannot use InheritableThreadLocal for message ids here since it's shared by parent and children + private ThreadLocal> workContext = new ThreadLocal>(); + + // [rfeng] Session id requires InheritableThreadLocal + private ThreadLocal> inheritableContext = new InheritableThreadLocal>(); + + public WorkContextImpl() { + super(); + } + + public Object getCurrentCorrelationId() { + Map map = workContext.get(); + if (map == null) { + return null; + } + return map.get(CORRELATION_ID); + } + + public void setCurrentCorrelationId(Object correlationId) { + Map map = getWorkContextMap(); + map.put(CORRELATION_ID, correlationId); + } + + public AtomicComponent getCurrentAtomicComponent() { + Map map = workContext.get(); + if (map == null) { + return null; + } + return (AtomicComponent) map.get(CURRENT_ATOMIC); + } + + public void setCurrentAtomicComponent(AtomicComponent component) { + Map map = getWorkContextMap(); + map.put(CURRENT_ATOMIC, component); + } + + @SuppressWarnings("unchecked") + public LinkedList getCurrentCallbackRoutingChain() { + Map map = workContext.get(); + if (map == null) { + return null; + } + return (LinkedList) map.get(CALLBACK_ROUTING_CHAIN); + } + + public void setCurrentCallbackRoutingChain(LinkedList callbackRoutingChain) { + Map map = getWorkContextMap(); + map.put(CALLBACK_ROUTING_CHAIN, callbackRoutingChain); + } + + public CompositeComponent getRemoteComponent() { + Map map = workContext.get(); + if (map == null) { + return null; + } + return (CompositeComponent) map.get(REMOTE_CONTEXT); + } + + + public void setRemoteComponent(CompositeComponent component) { + Map map = getWorkContextMap(); + map.put(REMOTE_CONTEXT, component); + } + + public Object getIdentifier(Object type) { + Map map = inheritableContext.get(); + if (map == null) { + return null; + } + Object currentId = map.get(type); + if (currentId instanceof ScopeIdentifier) { + currentId = ((ScopeIdentifier) currentId).getIdentifier(); + // once we have accessed the id, replace the lazy wrapper + map.put(type, currentId); + } + return currentId; + } + + public void setIdentifier(Object type, Object identifier) { + Map map = inheritableContext.get(); + if (map == null) { + map = new IdentityHashMap(); + inheritableContext.set(map); + } + map.put(type, identifier); + } + + public void clearIdentifier(Object type) { + if (type == null) { + return; + } + Map map = inheritableContext.get(); + if (map != null) { + map.remove(type); + } + } + + public void clearIdentifiers() { + inheritableContext.remove(); + } + + @SuppressWarnings({"unchecked"}) + public String popServiceName() { + Map map = inheritableContext.get(); + if (map == null) { + return null; + } + List stack = (List) map.get(CURRENT_SERVICE_NAMES); + if (stack == null || stack.size() < 1) { + return null; + } + String name = stack.remove(stack.size() - 1); + if (stack.size() == 0) { + // cleanup to avoid leaks + map.remove(CURRENT_SERVICE_NAMES); + } + return name; + } + + @SuppressWarnings({"unchecked"}) + public String getCurrentServiceName() { + Map map = inheritableContext.get(); + if (map == null) { + return null; + } + List stack = (List) map.get(CURRENT_SERVICE_NAMES); + if (stack == null || stack.size() < 1) { + return null; + } + return stack.get(stack.size() - 1); + } + + @SuppressWarnings({"unchecked"}) + public void pushServiceName(String name) { + Map map = inheritableContext.get(); + List names; + if (map == null) { + map = new IdentityHashMap(); + inheritableContext.set(map); + names = new ArrayList(); + map.put(CURRENT_SERVICE_NAMES, names); + } else { + names = (List) map.get(CURRENT_SERVICE_NAMES); + if (names == null) { + names = new ArrayList(); + map.put(CURRENT_SERVICE_NAMES, names); + } + } + names.add(name); + } + + public void clearServiceNames() { + Map map = inheritableContext.get(); + if (map == null) { + return; + } + map.remove(CURRENT_SERVICE_NAMES); + } + + private Map getWorkContextMap() { + Map map = workContext.get(); + if (map == null) { + map = new IdentityHashMap(); + workContext.set(map); + } + return map; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/AbstractEvent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/AbstractEvent.java new file mode 100644 index 0000000000..6d026ca08c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/AbstractEvent.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +import org.apache.tuscany.spi.event.Event; + +/** + * A basic implementation of a runtime event + * + * @version $$Rev$$ $$Date$$ + */ +public abstract class AbstractEvent implements Event { + protected Object source; + + public AbstractEvent(Object source) { + assert source != null : "Source id was null"; + this.source = source; + } + + public Object getSource() { + return source; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/AbstractRequestEvent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/AbstractRequestEvent.java new file mode 100644 index 0000000000..762b917600 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/AbstractRequestEvent.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +/** + * Base implementation of a request event + * + * @version $$Rev$$ $$Date$$ + */ +public abstract class AbstractRequestEvent extends AbstractEvent implements RequestEvent { + + /** + * Creates a new event + * + * @param source the source of the event + */ + public AbstractRequestEvent(Object source) { + super(source); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeEvent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeEvent.java new file mode 100644 index 0000000000..ce058404da --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeEvent.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.event.Event; + +/** + * Implemented by runtime events associated with a composite, e.g. lifecycle events + * + * @version $$Rev$$ $$Date$$ + */ +public interface CompositeEvent extends Event { + + CompositeComponent getComposite(); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeStart.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeStart.java new file mode 100644 index 0000000000..fba36feaf6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeStart.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +import org.apache.tuscany.spi.component.CompositeComponent; + +/** + * Propagated when a composite starts + * + * @version $$Rev$$ $$Date$$ + */ +public class CompositeStart extends AbstractEvent implements CompositeEvent { + + private CompositeComponent component; + + /** + * Creates a composite stop event + * + * @param source the source of the event + * @param component the composite component associated the composite being stopped + */ + public CompositeStart(Object source, CompositeComponent component) { + super(source); + this.component = component; + } + + public CompositeComponent getComposite() { + return component; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeStop.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeStop.java new file mode 100644 index 0000000000..6b3e37f619 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeStop.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +import org.apache.tuscany.spi.component.CompositeComponent; + +/** + * Propagated when a composite stops + * + * @version $$Rev$$ $$Date$$ + */ +public class CompositeStop extends AbstractEvent implements CompositeEvent { + + private CompositeComponent component; + + /** + * Creates a composite stop event + * + * @param source the source of the event + * @param component the composite component associated the composite being stopped + */ + public CompositeStop(Object source, CompositeComponent component) { + super(source); + this.component = component; + } + + public CompositeComponent getComposite() { + return component; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationEnd.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationEnd.java new file mode 100644 index 0000000000..4a51d970c3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationEnd.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +/** + * Propagated when a conversation session is expired + * + * @version $$Rev: 430937 $$ $$Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $$ + */ +public class ConversationEnd extends ConversationalEvent { + + public ConversationEnd(Object source, Object id) { + super(source, id); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationStart.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationStart.java new file mode 100644 index 0000000000..5725369bf6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationStart.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +/** + * Propagated when a conversation session has started + * + * @version $$Rev: 430937 $$ $$Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $$ + */ +public class ConversationStart extends ConversationalEvent { + + public ConversationStart(Object source, Object id) { + super(source, id); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationalEvent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationalEvent.java new file mode 100644 index 0000000000..a75086e745 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationalEvent.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +/** + * A base implementation of conversational session events in the runtime + * + * @version $$Rev: 430937 $$ $$Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $$ + */ +public class ConversationalEvent extends AbstractEvent { + + private Object id; + + public ConversationalEvent(Object source, Object id) { + super(source); + assert id != null : "Conversation id was null"; + this.id = id; + } + + public Object getId() { + return id; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpRequestEnded.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpRequestEnded.java new file mode 100644 index 0000000000..01bd769031 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpRequestEnded.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +/** + * Propagated when an HTTP-based request has ended. + * + * @version $$Rev: 430937 $$ $$Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $$ + */ +public class HttpRequestEnded extends HttpSessionEvent { + + /** + * Creates a new event + * + * @param source the source of the event + * @param id the id of the HTTP session being ended + */ + public HttpRequestEnded(Object source, Object id) { + super(source, id); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpRequestStart.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpRequestStart.java new file mode 100644 index 0000000000..9d0ff80dd7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpRequestStart.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +/** + * Propagated when an HTTP-based request has started + * + * @version $$Rev: 430937 $$ $$Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $$ + */ +public class HttpRequestStart extends HttpSessionEvent { + + /** + * Creates a new event + * + * @param source the source of the event + * @param id the id of the HTTP session being ended + */ + public HttpRequestStart(Object source, Object id) { + super(source, id); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEnd.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEnd.java new file mode 100644 index 0000000000..7f2bebe94a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEnd.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +/** + * Propagated when an HTTP-based session is expired + * + * @version $$Rev$$ $$Date$$ + */ +public class HttpSessionEnd extends HttpSessionEvent { + + /** + * Creates a new event + * + * @param source the source of the event + * @param id the id of the HTTP session being ended + */ + public HttpSessionEnd(Object source, Object id) { + super(source, id); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEvent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEvent.java new file mode 100644 index 0000000000..ed245d0930 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEvent.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +/** + * A base implementation of HTTP-based session events in the runtime + * + * @version $$Rev$$ $$Date$$ + */ +public abstract class HttpSessionEvent extends AbstractEvent { + + private Object id; + + public HttpSessionEvent(Object source, Object id) { + super(source); + assert id != null : "Session id was null"; + this.id = id; + } + + + public Object getSource() { + return source; + } + + public Object getId() { + return id; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionStart.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionStart.java new file mode 100644 index 0000000000..7f9c0fadea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionStart.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +/** + * Propagated when an HTTP-based session has started + * + * @version $$Rev$$ $$Date$$ + */ +public class HttpSessionStart extends HttpSessionEvent { + + /** + * Creates a new event + * + * @param source the source of the event + * @param id the id of the HTTP session being ended + */ + public HttpSessionStart(Object source, Object id) { + super(source, id); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestEnd.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestEnd.java new file mode 100644 index 0000000000..25856e86f8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestEnd.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +/** + * Propagated when a request completes or is ended + * + * @version $$Rev$$ $$Date$$ + */ +public class RequestEnd extends AbstractRequestEvent { + + /** + * Creates a new event + * + * @param source the source of the event + */ + public RequestEnd(Object source) { + super(source); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestEvent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestEvent.java new file mode 100644 index 0000000000..9a6d767236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestEvent.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +/** + * Implemented by runtime events associated request + * + * @version $$Rev$$ $$Date$$ + */ +public interface RequestEvent { + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestStart.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestStart.java new file mode 100644 index 0000000000..466f52551a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestStart.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.event; + +/** + * Propagated when a request is started in the runtime + * + * @version $$Rev$$ $$Date$$ + */ +public class RequestStart extends AbstractRequestEvent { + + /** + * Creates a new event + * + * @param source the source of the event + */ + public RequestStart(Object source) { + super(source); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/AbstractScopeContainer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/AbstractScopeContainer.java new file mode 100644 index 0000000000..cde61eaa5a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/AbstractScopeContainer.java @@ -0,0 +1,158 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; + +import org.apache.tuscany.spi.AbstractLifecycle; +import org.apache.tuscany.spi.component.AtomicComponent; +import org.apache.tuscany.spi.component.PersistenceException; +import org.apache.tuscany.spi.component.ScopeContainer; +import org.apache.tuscany.spi.component.ScopeContainerMonitor; +import org.apache.tuscany.spi.component.TargetNotFoundException; +import org.apache.tuscany.spi.component.TargetResolutionException; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.event.Event; +import org.apache.tuscany.spi.event.EventFilter; +import org.apache.tuscany.spi.event.RuntimeEventListener; +import org.apache.tuscany.spi.event.TrueFilter; + +/** + * Implements functionality common to scope contexts. + * + * @version $Rev$ $Date$ + */ +public abstract class AbstractScopeContainer extends AbstractLifecycle implements ScopeContainer { + private static final EventFilter TRUE_FILTER = new TrueFilter(); + + protected WorkContext workContext; + protected ScopeContainerMonitor monitor; + private Map> listeners; + + public AbstractScopeContainer(WorkContext workContext, ScopeContainerMonitor monitor) { + this.workContext = workContext; + this.monitor = monitor; + } + + public void addListener(RuntimeEventListener listener) { + addListener(TRUE_FILTER, listener); + } + + public void removeListener(RuntimeEventListener listener) { + assert listener != null; + synchronized (getListeners()) { + for (List currentList : getListeners().values()) { + for (RuntimeEventListener current : currentList) { + if (current == listener) { + currentList.remove(current); + return; + } + } + } + } + } + + public void addListener(EventFilter filter, RuntimeEventListener listener) { + assert listener != null; + synchronized (getListeners()) { + List list = getListeners().get(filter); + if (list == null) { + list = new CopyOnWriteArrayList(); + listeners.put(filter, list); + } + list.add(listener); + } + } + + public void publish(Event event) { + assert event != null; + for (Map.Entry> entry : getListeners().entrySet()) { + if (entry.getKey().match(event)) { + for (RuntimeEventListener listener : entry.getValue()) { + listener.onEvent(event); + } + } + } + } + + public Object getInstance(AtomicComponent component) throws TargetResolutionException { + InstanceWrapper ctx = getInstanceWrapper(component, true); + if (ctx != null) { + if (!ctx.isStarted()) { + ctx.start(); + } + return ctx.getInstance(); + } + return null; + } + + public Object getAssociatedInstance(AtomicComponent component) throws TargetResolutionException { + InstanceWrapper ctx = getInstanceWrapper(component, false); + if (ctx != null) { + if (!ctx.isStarted()) { + ctx.start(); + } + return ctx.getInstance(); + } + throw new TargetNotFoundException(component.getName()); + } + + public void persistNew(AtomicComponent component, String id, Object instance, long expiration) + throws PersistenceException { + throw new UnsupportedOperationException("Scope does not support persistence"); + + } + + public void persist(AtomicComponent component, String id, Object instance, long expiration) + throws PersistenceException { + throw new UnsupportedOperationException("Scope does not support persistence"); + } + + public void remove(AtomicComponent component) throws PersistenceException { + throw new UnsupportedOperationException("Scope does not support persistence"); + } + + protected Map> getListeners() { + if (listeners == null) { + listeners = new ConcurrentHashMap>(); + } + return listeners; + } + + protected void checkInit() { + if (getLifecycleState() != RUNNING) { + throw new IllegalStateException("Scope container not running [" + getLifecycleState() + "]"); + } + } + + protected WorkContext getWorkContext() { + return workContext; + } + + public String toString() { + return "In state [" + super.toString() + ']'; + } + + protected abstract InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create) + throws TargetResolutionException; +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java new file mode 100644 index 0000000000..21ff792282 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java @@ -0,0 +1,189 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.tuscany.spi.ObjectCreationException; +import org.apache.tuscany.spi.component.AtomicComponent; +import org.apache.tuscany.spi.component.ScopeContainerMonitor; +import org.apache.tuscany.spi.component.TargetDestructionException; +import org.apache.tuscany.spi.component.TargetInitializationException; +import org.apache.tuscany.spi.component.TargetResolutionException; +import org.apache.tuscany.spi.event.Event; +import org.apache.tuscany.spi.model.Scope; + +import org.apache.tuscany.core.component.event.CompositeStart; +import org.apache.tuscany.core.component.event.CompositeStop; + +/** + * A scope context which manages atomic component instances keyed by composite + * + * @version $Rev$ $Date$ + */ +public class CompositeScopeContainer extends AbstractScopeContainer { + private static final InstanceWrapper EMPTY = new EmptyWrapper(); + private static final ComponentInitComparator COMPARATOR = new ComponentInitComparator(); + + private final Map instanceWrappers; + // the queue of instanceWrappers to destroy, in the order that their instances were created + private final List destroyQueue; + + public CompositeScopeContainer(ScopeContainerMonitor monitor) { + super(null, monitor); + instanceWrappers = new ConcurrentHashMap(); + destroyQueue = new ArrayList(); + } + + public Scope getScope() { + return Scope.COMPOSITE; + } + + public void onEvent(Event event) { + checkInit(); + if (event instanceof CompositeStart) { + try { + eagerInitComponents(); + } catch (ObjectCreationException e) { + monitor.eagerInitializationError(e); + } catch (TargetResolutionException e) { + monitor.eagerInitializationError(e); + } + lifecycleState = RUNNING; + } else if (event instanceof CompositeStop) { + shutdownContexts(); + } + } + + public synchronized void start() { + if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) { + throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]"); + } + lifecycleState = RUNNING; + } + + public synchronized void stop() { + checkInit(); + instanceWrappers.clear(); + synchronized (destroyQueue) { + destroyQueue.clear(); + } + lifecycleState = STOPPED; + } + + /** + * Notifies instanceWrappers of a shutdown in reverse order to which they were started + */ + private void shutdownContexts() { + if (destroyQueue.size() == 0) { + return; + } + synchronized (destroyQueue) { + // shutdown destroyable instances in reverse instantiation order + ListIterator iter = destroyQueue.listIterator(destroyQueue.size()); + while (iter.hasPrevious()) { + try { + iter.previous().stop(); + } catch (TargetDestructionException e) { + monitor.destructionError(e); + } + } + destroyQueue.clear(); + } + } + + public void register(AtomicComponent component) { + checkInit(); + instanceWrappers.put(component, EMPTY); + } + + protected InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create) + throws TargetResolutionException { + checkInit(); + InstanceWrapper ctx = instanceWrappers.get(component); + assert ctx != null; + if (ctx == EMPTY && !create) { + return null; + } + if (ctx == EMPTY) { + ctx = new InstanceWrapperImpl(component, component.createInstance()); + ctx.start(); + instanceWrappers.put(component, ctx); + synchronized (destroyQueue) { + destroyQueue.add(ctx); + } + } + return ctx; + } + + private void eagerInitComponents() throws ObjectCreationException, TargetResolutionException { + List componentList = new ArrayList(instanceWrappers.keySet()); + Collections.sort(componentList, COMPARATOR); + // start each group + for (AtomicComponent component : componentList) { + if (component.getInitLevel() <= 0) { + // Don't eagerly init + continue; + } + // the instance could have been created from a depth-first traversal + InstanceWrapper ctx = instanceWrappers.get(component); + if (ctx == EMPTY) { + try { + ctx = new InstanceWrapperImpl(component, component.createInstance()); + } catch (ObjectCreationException e) { + e.addContextName(component.getName()); + throw e; + } + ctx.start(); + instanceWrappers.put(component, ctx); + destroyQueue.add(ctx); + } + } + } + + private static class ComponentInitComparator implements Comparator { + public int compare(AtomicComponent o1, AtomicComponent o2) { + return o1.getInitLevel() - o2.getInitLevel(); + } + } + + private static class EmptyWrapper implements InstanceWrapper { + public Object getInstance() { + return null; + } + + public boolean isStarted() { + return true; + } + + public void start() throws TargetInitializationException { + + } + + public void stop() throws TargetDestructionException { + + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeObjectFactory.java new file mode 100644 index 0000000000..a761f05d4b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeObjectFactory.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import org.osoa.sca.annotations.EagerInit; + +import org.apache.tuscany.spi.ObjectCreationException; +import org.apache.tuscany.spi.ObjectFactory; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.ScopeContainerMonitor; +import org.apache.tuscany.spi.component.ScopeRegistry; +import org.apache.tuscany.spi.model.Scope; + +import org.apache.tuscany.api.annotation.Monitor; + +/** + * Creates a new composite scope context + * + * @version $$Rev$$ $$Date$$ + */ +@EagerInit +public class CompositeScopeObjectFactory implements ObjectFactory { + private ScopeContainerMonitor monitor; + + public CompositeScopeObjectFactory(@Autowire ScopeRegistry registry, + @Monitor ScopeContainerMonitor monitor) { + registry.registerFactory(Scope.COMPOSITE, this); + this.monitor = monitor; + } + + public CompositeScopeContainer getInstance() throws ObjectCreationException { + return new CompositeScopeContainer(monitor); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainer.java new file mode 100644 index 0000000000..1a77f3ecb3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainer.java @@ -0,0 +1,217 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.tuscany.spi.component.AtomicComponent; +import org.apache.tuscany.spi.component.PersistenceException; +import org.apache.tuscany.spi.component.SCAObject; +import org.apache.tuscany.spi.component.ScopeContainer; +import org.apache.tuscany.spi.component.ScopeContainerMonitor; +import org.apache.tuscany.spi.component.TargetDestructionException; +import org.apache.tuscany.spi.component.TargetNotFoundException; +import org.apache.tuscany.spi.component.TargetResolutionException; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.event.Event; +import org.apache.tuscany.spi.event.RuntimeEventListener; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.services.store.Store; +import org.apache.tuscany.spi.services.store.StoreExpirationEvent; +import org.apache.tuscany.spi.services.store.StoreReadException; +import org.apache.tuscany.spi.services.store.StoreWriteException; + +/** + * A scope context which manages atomic component instances keyed on a conversation session + * + * @version $Rev: 452655 $ $Date: 2006-10-03 18:09:02 -0400 (Tue, 03 Oct 2006) $ + */ +public class ConversationalScopeContainer extends AbstractScopeContainer implements ScopeContainer { + private Store nonDurableStore; + private Map components; + + public ConversationalScopeContainer(Store store, WorkContext workContext, final ScopeContainerMonitor monitor) { + super(workContext, monitor); + this.nonDurableStore = store; + if (store != null) { + store.addListener(new ExpirationListener(monitor)); + } + components = new ConcurrentHashMap(); + } + + public Scope getScope() { + return Scope.CONVERSATION; + } + + public void onEvent(Event event) { + checkInit(); + } + + public synchronized void start() { + if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) { + throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]"); + } + lifecycleState = RUNNING; + } + + public synchronized void stop() { + lifecycleState = STOPPED; + } + + public void register(AtomicComponent component) { + components.put(component, component); + component.addListener(this); + } + + @Override + public Object getInstance(AtomicComponent component) throws TargetResolutionException { + String conversationId = getConversationId(); + try { + workContext.setCurrentAtomicComponent(component); + Object instance = nonDurableStore.readRecord(component, conversationId); + if (instance != null) { + if (component.getMaxIdleTime() > 0) { + // update expiration + long expire = System.currentTimeMillis() + component.getMaxIdleTime(); + nonDurableStore.updateRecord(component, conversationId, instance, expire); + } + } else { + instance = component.createInstance(); + long expire = calculateExpiration(component); + nonDurableStore.insertRecord(component, conversationId, instance, expire); + component.init(instance); + } + return instance; + } catch (StoreReadException e) { + throw new TargetResolutionException("Error retrieving target instance", e); + } catch (StoreWriteException e) { + throw new TargetResolutionException("Error persisting target instance", e); + } finally { + workContext.setCurrentAtomicComponent(null); + } + } + + public Object getAssociatedInstance(AtomicComponent component) throws TargetResolutionException { + String conversationId = getConversationId(); + try { + workContext.setCurrentAtomicComponent(component); + Object instance = nonDurableStore.readRecord(component, conversationId); + if (instance != null) { + if (component.getMaxIdleTime() > 0) { + // update expiration + long expire = System.currentTimeMillis() + component.getMaxIdleTime(); + nonDurableStore.updateRecord(component, conversationId, instance, expire); + } + return instance; + } else { + throw new TargetNotFoundException(component.getName()); + } + } catch (StoreReadException e) { + throw new TargetResolutionException("Error retrieving target instance", e); + } catch (StoreWriteException e) { + throw new TargetResolutionException("Error persisting target instance", e); + } finally { + workContext.setCurrentAtomicComponent(null); + } + } + + public void persistNew(AtomicComponent component, String id, Object instance, long expiration) + throws PersistenceException { + try { + nonDurableStore.insertRecord(component, id, instance, expiration); + } catch (StoreWriteException e) { + throw new PersistenceException(e); + } + } + + public void persist(AtomicComponent component, String id, Object instance, long expiration) + throws PersistenceException { + try { + nonDurableStore.updateRecord(component, id, instance, expiration); + } catch (StoreWriteException e) { + throw new PersistenceException(e); + } + } + + public void remove(AtomicComponent component) throws PersistenceException { + String conversationId = getConversationId(); + try { + workContext.setCurrentAtomicComponent(component); + Object instance = nonDurableStore.readRecord(component, conversationId); + if (instance != null) { + nonDurableStore.removeRecord(component, conversationId); + } + } catch (StoreReadException e) { + throw new PersistenceException(e); + } catch (StoreWriteException e) { + throw new PersistenceException(e); + } + } + + protected InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create) { + throw new UnsupportedOperationException(); + } + + /** + * Returns the conversation id associated with the current invocation context + */ + private String getConversationId() { + String conversationId = (String) workContext.getIdentifier(Scope.CONVERSATION); + assert conversationId != null; + return conversationId; + } + + private long calculateExpiration(AtomicComponent component) { + if (component.getMaxAge() > 0) { + long now = System.currentTimeMillis(); + return now + component.getMaxAge(); + } else if (component.getMaxIdleTime() > 0) { + long now = System.currentTimeMillis(); + return now + component.getMaxIdleTime(); + } else { + return Store.DEFAULT_EXPIRATION_OFFSET; + } + } + + /** + * Receives expiration events from the store and notifies the corresponding atomic component + */ + private static class ExpirationListener implements RuntimeEventListener { + private final ScopeContainerMonitor monitor; + + public ExpirationListener(ScopeContainerMonitor monitor) { + this.monitor = monitor; + } + + public void onEvent(Event event) { + if (event instanceof StoreExpirationEvent) { + StoreExpirationEvent expiration = (StoreExpirationEvent) event; + SCAObject object = expiration.getOwner(); + assert object instanceof AtomicComponent; + AtomicComponent owner = (AtomicComponent) object; + try { + owner.destroy(expiration.getInstance()); + } catch (TargetDestructionException e) { + monitor.destructionError(e); + } + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeObjectFactory.java new file mode 100644 index 0000000000..32dfaed8d9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeObjectFactory.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import org.osoa.sca.annotations.EagerInit; + +import org.apache.tuscany.spi.ObjectCreationException; +import org.apache.tuscany.spi.ObjectFactory; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.ScopeContainerMonitor; +import org.apache.tuscany.spi.component.ScopeRegistry; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.services.store.Store; + +import org.apache.tuscany.api.annotation.Monitor; + +/** + * Creates a new Session Scope context + * + * @version $$Rev: 450456 $$ $$Date: 2006-09-27 10:28:36 -0400 (Wed, 27 Sep 2006) $$ + */ +@EagerInit +public class ConversationalScopeObjectFactory implements ObjectFactory { + private WorkContext context; + private Store store; + private ScopeContainerMonitor monitor; + + public ConversationalScopeObjectFactory(@Autowire ScopeRegistry registry, + @Autowire WorkContext context, + @Autowire Store store, + @Monitor ScopeContainerMonitor monitor) { + registry.registerFactory(Scope.CONVERSATION, this); + this.context = context; + this.store = store; + this.monitor = monitor; + } + + public ConversationalScopeContainer getInstance() throws ObjectCreationException { + return new ConversationalScopeContainer(store, context, monitor); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java new file mode 100644 index 0000000000..83c79b2367 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java @@ -0,0 +1,135 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import java.util.ArrayList; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.tuscany.spi.component.AtomicComponent; +import org.apache.tuscany.spi.component.ScopeContainerMonitor; +import org.apache.tuscany.spi.component.TargetDestructionException; +import org.apache.tuscany.spi.component.TargetResolutionException; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.event.Event; +import org.apache.tuscany.spi.model.Scope; + +import org.apache.tuscany.core.component.event.HttpSessionEnd; + +/** + * A scope context which manages atomic component instances keyed on HTTP session + * + * @version $Rev$ $Date$ + */ +public class HttpSessionScopeContainer extends AbstractScopeContainer { + private final Map> contexts; + private final Map> destroyQueues; + + public HttpSessionScopeContainer(WorkContext workContext, ScopeContainerMonitor monitor) { + super(workContext, monitor); + contexts = new ConcurrentHashMap>(); + destroyQueues = new ConcurrentHashMap>(); + } + + public Scope getScope() { + return Scope.SESSION; + } + + public void onEvent(Event event) { + checkInit(); + if (event instanceof HttpSessionEnd) { + Object key = ((HttpSessionEnd) event).getId(); + shutdownInstances(key); + workContext.clearIdentifier(key); + } + } + + public synchronized void start() { + if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) { + throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]"); + } + lifecycleState = RUNNING; + } + + public synchronized void stop() { + contexts.clear(); + synchronized (destroyQueues) { + destroyQueues.clear(); + } + lifecycleState = STOPPED; + } + + public void register(AtomicComponent component) { + contexts.put(component, new ConcurrentHashMap()); + component.addListener(this); + } + + protected InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create) + throws TargetResolutionException { + Object key = workContext.getIdentifier(Scope.SESSION); + assert key != null : "HTTP session key not bound in work context"; + return getInstance(component, key, create); + } + + private InstanceWrapper getInstance(AtomicComponent component, Object key, boolean create) + throws TargetResolutionException { + Map wrappers = contexts.get(component); + InstanceWrapper ctx = wrappers.get(key); + if (ctx == null && !create) { + return null; + } + if (ctx == null) { + ctx = new InstanceWrapperImpl(component, component.createInstance()); + ctx.start(); + wrappers.put(key, ctx); + List destroyQueue = destroyQueues.get(key); + if (destroyQueue == null) { + destroyQueue = new ArrayList(); + destroyQueues.put(key, destroyQueue); + } + synchronized (destroyQueue) { + destroyQueue.add(ctx); + } + } + return ctx; + + } + + private void shutdownInstances(Object key) { + List destroyQueue = destroyQueues.remove(key); + if (destroyQueue != null) { + for (Map map : contexts.values()) { + map.remove(key); + } + ListIterator iter = destroyQueue.listIterator(destroyQueue.size()); + synchronized (destroyQueue) { + while (iter.hasPrevious()) { + try { + iter.previous().stop(); + } catch (TargetDestructionException e) { + monitor.destructionError(e); + } + } + } + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeObjectFactory.java new file mode 100644 index 0000000000..14713f9144 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeObjectFactory.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import org.osoa.sca.annotations.EagerInit; + +import org.apache.tuscany.spi.ObjectCreationException; +import org.apache.tuscany.spi.ObjectFactory; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.ScopeContainerMonitor; +import org.apache.tuscany.spi.component.ScopeRegistry; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.model.Scope; + +import org.apache.tuscany.api.annotation.Monitor; + +/** + * Creates a new HTTP session scope context + * + * @version $$Rev$$ $$Date$$ + */ +@EagerInit +public class HttpSessionScopeObjectFactory implements ObjectFactory { + private WorkContext context; + private ScopeContainerMonitor monitor; + + public HttpSessionScopeObjectFactory(@Autowire ScopeRegistry registry, + @Autowire WorkContext context, + @Monitor ScopeContainerMonitor monitor) { + registry.registerFactory(Scope.SESSION, this); + this.context = context; + this.monitor = monitor; + } + + public HttpSessionScopeContainer getInstance() throws ObjectCreationException { + return new HttpSessionScopeContainer(context, monitor); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapper.java new file mode 100644 index 0000000000..50f4a31128 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapper.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import org.apache.tuscany.spi.component.TargetDestructionException; +import org.apache.tuscany.spi.component.TargetInitializationException; + +/** + * Provides lifecycle management for an implementation instance associated with an {@link + * org.apache.tuscany.spi.component.AtomicComponent} for use by the atomic component's associated {@link + * org.apache.tuscany.spi.component.ScopeContainer} + * + * @version $Rev$ $Date$ + */ +public interface InstanceWrapper { + + Object getInstance(); + + boolean isStarted(); + + void start() throws TargetInitializationException; + + void stop() throws TargetDestructionException; + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperImpl.java new file mode 100644 index 0000000000..c4648d1e7b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperImpl.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import org.apache.tuscany.spi.component.AtomicComponent; +import org.apache.tuscany.spi.component.TargetDestructionException; +import org.apache.tuscany.spi.component.TargetInitializationException; + +/** + * Default implementation of an InstanceWrapper + * + * @version $$Rev$$ $$Date$$ + */ +public class InstanceWrapperImpl implements InstanceWrapper { + private Object instance; + private AtomicComponent component; + private boolean started; + + public InstanceWrapperImpl(AtomicComponent component, Object instance) { + assert component != null; + assert instance != null; + this.component = component; + this.instance = instance; + } + + public boolean isStarted() { + return started; + } + + public Object getInstance() { + if (!started) { + throw new IllegalStateException("Instance not started"); + } + return instance; + } + + public void start() throws TargetInitializationException { + component.init(instance); + started = true; + } + + public void stop() throws TargetDestructionException { + component.destroy(instance); + started = false; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java new file mode 100644 index 0000000000..22beaae740 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java @@ -0,0 +1,126 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import java.util.ArrayList; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.tuscany.spi.component.AtomicComponent; +import org.apache.tuscany.spi.component.ScopeContainerMonitor; +import org.apache.tuscany.spi.component.TargetDestructionException; +import org.apache.tuscany.spi.component.TargetResolutionException; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.event.Event; +import org.apache.tuscany.spi.model.Scope; + +import org.apache.tuscany.core.component.event.RequestEnd; + +/** + * A scope context which manages atomic component instances keyed on the current request context + * + * @version $Rev$ $Date$ + */ +public class RequestScopeContainer extends AbstractScopeContainer { + private final Map> contexts; + private final Map> destroyQueues; + + public RequestScopeContainer(WorkContext workContext, ScopeContainerMonitor monitor) { + super(workContext, monitor); + contexts = new ConcurrentHashMap>(); + destroyQueues = new ConcurrentHashMap>(); + } + + public Scope getScope() { + return Scope.REQUEST; + } + + public void onEvent(Event event) { + checkInit(); + if (event instanceof RequestEnd) { + shutdownInstances(Thread.currentThread()); + } + } + + public synchronized void start() { + if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) { + throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]"); + } + lifecycleState = RUNNING; + } + + public synchronized void stop() { + contexts.clear(); + synchronized (destroyQueues) { + destroyQueues.clear(); + } + lifecycleState = STOPPED; + } + + public void register(AtomicComponent component) { + contexts.put(component, new ConcurrentHashMap()); + } + + protected InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create) + throws TargetResolutionException { + Map instanceContextMap = contexts.get(component); + assert instanceContextMap != null : "Atomic component not registered"; + InstanceWrapper ctx = instanceContextMap.get(Thread.currentThread()); + if (ctx == null && !create) { + return null; + } + if (ctx == null) { + ctx = new InstanceWrapperImpl(component, component.createInstance()); + ctx.start(); + instanceContextMap.put(Thread.currentThread(), ctx); + List destroyQueue = destroyQueues.get(Thread.currentThread()); + if (destroyQueue == null) { + destroyQueue = new ArrayList(); + destroyQueues.put(Thread.currentThread(), destroyQueue); + } + synchronized (destroyQueue) { + destroyQueue.add(ctx); + } + } + return ctx; + } + + private void shutdownInstances(Thread key) { + List destroyQueue = destroyQueues.remove(key); + if (destroyQueue != null && destroyQueue.size() > 0) { + Thread thread = Thread.currentThread(); + for (Map map : contexts.values()) { + map.remove(thread); + } + ListIterator iter = destroyQueue.listIterator(destroyQueue.size()); + synchronized (destroyQueue) { + while (iter.hasPrevious()) { + try { + iter.previous().stop(); + } catch (TargetDestructionException e) { + monitor.destructionError(e); + } + } + } + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeObjectFactory.java new file mode 100644 index 0000000000..0377bcd548 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeObjectFactory.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import org.apache.tuscany.spi.ObjectCreationException; +import org.apache.tuscany.spi.ObjectFactory; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.ScopeContainerMonitor; +import org.apache.tuscany.spi.component.WorkContext; + +import org.apache.tuscany.api.annotation.Monitor; + +/** + * Creates a new request scope context + * + * @version $$Rev$$ $$Date$$ + */ +public class RequestScopeObjectFactory implements ObjectFactory { + private WorkContext context; + private ScopeContainerMonitor monitor; + + + public RequestScopeObjectFactory(@Autowire WorkContext context, @Monitor ScopeContainerMonitor monitor) { + this.context = context; + this.monitor = monitor; + } + + public RequestScopeContainer getInstance() throws ObjectCreationException { + return new RequestScopeContainer(context, monitor); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ScopeRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ScopeRegistryImpl.java new file mode 100644 index 0000000000..da338dd0ef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ScopeRegistryImpl.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.tuscany.spi.ObjectFactory; +import org.apache.tuscany.spi.component.ScopeContainer; +import org.apache.tuscany.spi.component.ScopeRegistry; +import org.apache.tuscany.spi.model.Scope; + +/** + * The default implementation of a scope registry + * + * @version $Rev$ $Date$ + */ +public class ScopeRegistryImpl implements ScopeRegistry { + private final Map scopeCache = + new ConcurrentHashMap(); + private final Map> factoryCache = + new ConcurrentHashMap>(); + + public ScopeContainer getScopeContainer(Scope scope) { + assert Scope.COMPOSITE != scope; + ScopeContainer container = scopeCache.get(scope); + if (container == null) { + ObjectFactory factory = factoryCache.get(scope); + if (factory != null) { + container = factory.getInstance(); + container.start(); + scopeCache.put(scope, container); + } + } + return container; + } + + public void registerFactory(Scope scope, ObjectFactory factory) { + factoryCache.put(scope, factory); + } + + public void deregisterFactory(Scope scope) { + factoryCache.remove(scope); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java new file mode 100644 index 0000000000..cbd47b6cdd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import org.apache.tuscany.spi.component.AtomicComponent; +import org.apache.tuscany.spi.component.ScopeContainerMonitor; +import org.apache.tuscany.spi.component.TargetResolutionException; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.event.Event; +import org.apache.tuscany.spi.model.Scope; + +/** + * A scope context which manages stateless atomic component instances in a non-pooled fashion + * + * @version $Rev$ $Date$ + */ +public class StatelessScopeContainer extends AbstractScopeContainer { + + public StatelessScopeContainer(WorkContext workContext, ScopeContainerMonitor monitor) { + super(workContext, monitor); + } + + public Scope getScope() { + return Scope.STATELESS; + } + + public synchronized void start() { + if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) { + throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]"); + } + lifecycleState = RUNNING; + } + + public synchronized void stop() { + if (lifecycleState != RUNNING) { + throw new IllegalStateException("Scope in wrong state [" + lifecycleState + "]"); + } + lifecycleState = STOPPED; + } + + public void onEvent(Event event) { + } + + public void register(AtomicComponent component) { + checkInit(); + } + + protected InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create) + throws TargetResolutionException { + // there never is a previously associated instance, return null + if (!create) { + return null; + } + InstanceWrapper ctx = new InstanceWrapperImpl(component, component.createInstance()); + ctx.start(); + return ctx; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeObjectFactory.java new file mode 100644 index 0000000000..8e05510723 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeObjectFactory.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.component.scope; + +import org.osoa.sca.annotations.EagerInit; + +import org.apache.tuscany.spi.ObjectCreationException; +import org.apache.tuscany.spi.ObjectFactory; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.ScopeContainerMonitor; +import org.apache.tuscany.spi.component.ScopeRegistry; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.model.Scope; + +import org.apache.tuscany.api.annotation.Monitor; + +/** + * Creates a new stateless scope context + * + * @version $$Rev$$ $$Date$$ + */ +@EagerInit +public class StatelessScopeObjectFactory implements ObjectFactory { + private WorkContext context; + private ScopeContainerMonitor monitor; + + public StatelessScopeObjectFactory(@Autowire ScopeRegistry registry, + @Autowire WorkContext context, + @Monitor ScopeContainerMonitor monitor) { + registry.registerFactory(Scope.STATELESS, this); + this.context = context; + this.monitor = monitor; + } + + public StatelessScopeContainer getInstance() throws ObjectCreationException { + return new StatelessScopeContainer(context, monitor); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingInteceptor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingInteceptor.java new file mode 100644 index 0000000000..aedd715fed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingInteceptor.java @@ -0,0 +1,250 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.impl; + +import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.ExceptionHandler; +import org.apache.tuscany.spi.databinding.Mediator; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.idl.ServiceFaultException; +import org.apache.tuscany.spi.model.DataType; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.Interceptor; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.Wire; + +/** + * An interceptor to transform data accross databindings on the wire + * + * @version $Rev$ $Date$ + */ +public class DataBindingInteceptor implements Interceptor { + private Interceptor next; + + private CompositeComponent compositeComponent; + + private Operation sourceOperation; + + private Operation targetOperation; + + private Mediator mediator; + + public DataBindingInteceptor(Wire sourceWire, Operation sourceOperation, Operation targetOperation) { + super(); + // this.sourceWire = sourceWire; + this.sourceOperation = sourceOperation; + // this.targetWire = targetWire; + this.targetOperation = targetOperation; + this.compositeComponent = sourceWire.getContainer().getParent(); + } + + /** + * @see org.apache.tuscany.spi.wire.Interceptor#getNext() + */ + public Interceptor getNext() { + return next; + } + + /** + * @see org.apache.tuscany.spi.wire.Interceptor#invoke(org.apache.tuscany.spi.wire.Message) + */ + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.spi.wire.Interceptor#invoke(org.apache.tuscany.spi.wire.Message) + */ + public Message invoke(Message msg) { + Object input = transform(msg.getBody(), sourceOperation.getInputType(), targetOperation.getInputType()); + msg.setBody(input); + Message resultMsg = next.invoke(msg); + Object result = resultMsg.getBody(); + if (sourceOperation.isNonBlocking()) { + // Not to reset the message body + return resultMsg; + } + + // FIXME: Should we fix the Operation model so that getOutputType + // returns DataType>? + DataType targetType = + new DataType(DataBinding.IDL_OUTPUT, Object.class, targetOperation.getOutputType()); + + targetType.setOperation(targetOperation.getOutputType().getOperation()); + DataType sourceType = + new DataType(DataBinding.IDL_OUTPUT, Object.class, sourceOperation.getOutputType()); + sourceType.setOperation(sourceOperation.getOutputType().getOperation()); + + if (resultMsg.isFault()) { + + // FIXME: We need to figure out what fault type it is and then + // transform it + // back the source fault type + // throw new InvocationRuntimeException((Throwable) result); + + if ((result instanceof Exception) && !(result instanceof RuntimeException)) { + // FIXME: How to match fault data to a fault type for the + // operation? + + // If the result is from an InvocationTargetException look at + // the actual cause. + if (result instanceof InvocationTargetException) { + result = ((InvocationTargetException)result).getCause(); + } + DataType targetDataType = null; + for (DataType exType : targetOperation.getFaultTypes()) { + if (((Class)exType.getPhysical()).isInstance(result)) { + if (result instanceof ServiceFaultException) { + if (((ServiceFaultException)result).isMatchingType(exType.getLogical())) { + targetDataType = exType; + break; + } + + } else { + targetDataType = exType; + break; + } + } + } + + if (targetDataType == null) { + // Not a business exception + return resultMsg; + } + + DataType targetFaultType = getFaultType(targetDataType); + if (targetFaultType == null) { + throw new TransformationException("Target fault type cannot be resolved"); + } + + // FIXME: How to match a source fault type to a target fault + // type? + DataType sourceDataType = null; + DataType sourceFaultType = null; + for (DataType exType : sourceOperation.getFaultTypes()) { + DataType faultType = getFaultType(exType); + // Match by the QName (XSD element) of the fault type + if (faultType != null && targetFaultType.getLogical().equals(faultType.getLogical())) { + sourceDataType = exType; + sourceFaultType = faultType; + break; + } + } + + if (sourceFaultType == null) { + throw new TransformationException("No matching source fault type is found"); + } + + Object newResult = + transformException(result, targetDataType, sourceDataType, targetFaultType, sourceFaultType); + if (newResult != result) { + resultMsg.setBodyWithFault(newResult); + } + } + + } else { + assert !(result instanceof Throwable) : "Expected messages that are not throwable " + result; + + Object newResult = transform(result, targetType, sourceType); + if (newResult != result) { + resultMsg.setBody(newResult); + } + } + + return resultMsg; + } + + private Object transform(Object source, DataType sourceType, DataType targetType) { + if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) { + return source; + } + Map, Object> metadata = new HashMap, Object>(); + metadata.put(CompositeComponent.class, compositeComponent); + return mediator.mediate(source, sourceType, targetType, metadata); + } + + private DataType getFaultType(DataType exceptionType) { + // FIXME: We cannot assume the exception will have a databinding set + DataBinding targetDataBinding = + mediator.getDataBindingRegistry().getDataBinding(exceptionType.getDataBinding()); + if (targetDataBinding == null) { + return null; + } + ExceptionHandler targetHandler = targetDataBinding.getExceptionHandler(); + if (targetHandler == null) { + return null; + } + return targetHandler.getFaultType(exceptionType); + } + + /** + * @param source The source exception + * @param sourceExType The data type for the source exception + * @param targetExType The data type for the target exception + * @param sourceType The fault type for the source + * @param targetType The fault type for the target + * @return + */ + private Object transformException(Object source, + DataType sourceExType, + DataType targetExType, + DataType sourceType, + DataType targetType) { + if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) { + return source; + } + Map, Object> metadata = new HashMap, Object>(); + metadata.put(CompositeComponent.class, compositeComponent); + + DataType> eSourceDataType = + new DataType>("idl:fault", sourceExType.getPhysical(), sourceType); + DataType> eTargetDataType = + new DataType>("idl:fault", targetExType.getPhysical(), targetType); + + return mediator.mediate(source, eSourceDataType, eTargetDataType, metadata); + } + + /** + * @see org.apache.tuscany.spi.wire.Interceptor#isOptimizable() + */ + public boolean isOptimizable() { + return false; + } + + /** + * @see org.apache.tuscany.spi.wire.Interceptor#setNext(org.apache.tuscany.spi.wire.Interceptor) + */ + public void setNext(Interceptor next) { + this.next = next; + } + + /** + * @param mediator the mediator to set + */ + public void setMediator(Mediator mediator) { + this.mediator = mediator; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java new file mode 100644 index 0000000000..6e176cf0a6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java @@ -0,0 +1,126 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.impl; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.lang.reflect.Type; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.xml.datatype.Duration; +import javax.xml.datatype.XMLGregorianCalendar; + +import org.apache.tuscany.api.annotation.DataType; +import org.apache.tuscany.api.annotation.IDLMapping; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.databinding.DataBindingRegistry; +import org.apache.tuscany.spi.idl.InvalidServiceContractException; +import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorExtension; +import org.apache.tuscany.spi.idl.java.JavaServiceContract; +import org.apache.tuscany.spi.model.Operation; + +/** + * The databinding annotation processor for java interfaces + * + * @version $Rev$ $Date$ + */ +public class DataBindingJavaInterfaceProcessor extends JavaInterfaceProcessorExtension { + private static final Class[] SIMPLE_JAVA_TYPES = + {Byte.class, Character.class, Short.class, Integer.class, Long.class, Float.class, Double.class, Date.class, + Calendar.class, GregorianCalendar.class, Duration.class, XMLGregorianCalendar.class, BigInteger.class, + BigDecimal.class}; + + private static final Set SIMPLE_TYPE_SET = new HashSet(Arrays.asList(SIMPLE_JAVA_TYPES)); + + private DataBindingRegistry dataBindingRegistry; + + public DataBindingJavaInterfaceProcessor(@Autowire + DataBindingRegistry dataBindingRegistry) { + super(); + this.dataBindingRegistry = dataBindingRegistry; + } + + public void visitInterface(Class clazz, Class callbackClass, JavaServiceContract contract) + throws InvalidServiceContractException { + if (!contract.isRemotable()) { + return; + } + Map> operations = contract.getOperations(); + processInterface(clazz, contract, operations); + if (callbackClass != null) { + Map> callbackOperations = contract.getCallbackOperations(); + processInterface(callbackClass, contract, callbackOperations); + } + } + + private void processInterface(Class clazz, JavaServiceContract contract, + Map> operations) { + IDLMapping interfaceMapping = clazz.getAnnotation(IDLMapping.class); + DataType interfaceDataType = clazz.getAnnotation(DataType.class); + if (interfaceDataType != null) { + contract.setDataBinding(interfaceDataType.name()); + } + for (Method method : clazz.getMethods()) { + Operation operation = operations.get(method.getName()); + DataType operationDataType = method.getAnnotation(DataType.class); + if (operationDataType == null) { + operationDataType = interfaceDataType; + } + + if (operationDataType != null) { + operation.setDataBinding(operationDataType.name()); + // FIXME: [rfeng] Keep data context as metadata? + } + IDLMapping operationMapping = clazz.getAnnotation(IDLMapping.class); + if (operationMapping == null) { + operationMapping = interfaceMapping; + } + + if (operationMapping != null) { + operation.setDataBinding(operationMapping.dataBinding()); + operation.setWrapperStyle(operationMapping.wrapperStyle()); + } + // String dataBinding = operation.getDataBinding(); + + Annotation[] annotations = null; + if (operationDataType != null) { + annotations = new Annotation[] {operationDataType}; + } + // FIXME: We need a better way to identify simple java types + for (org.apache.tuscany.spi.model.DataType d : operation.getInputType().getLogical()) { + dataBindingRegistry.introspectType(d, annotations); + } + if (operation.getOutputType() != null) { + dataBindingRegistry.introspectType(operation.getOutputType(), annotations); + } + for (org.apache.tuscany.spi.model.DataType d : operation.getFaultTypes()) { + dataBindingRegistry.introspectType(d, annotations); + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingRegistryImpl.java new file mode 100644 index 0000000000..8c7f7e28ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingRegistryImpl.java @@ -0,0 +1,121 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.impl; + +import java.lang.annotation.Annotation; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.apache.tuscany.core.databinding.javabeans.JavaBeansDataBinding; +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.DataBindingRegistry; +import org.apache.tuscany.spi.model.DataType; +import org.osoa.sca.annotations.EagerInit; + +/** + * The default implementation of a data binding registry + * + * @version $Rev$ $Date$ + */ +@EagerInit +public class DataBindingRegistryImpl implements DataBindingRegistry { + private final Map bindings = new HashMap(); + + public DataBinding getDataBinding(String id) { + if (id == null) { + return null; + } + return bindings.get(id.toLowerCase()); + } + + public void register(DataBinding dataBinding) { + bindings.put(dataBinding.getName().toLowerCase(), dataBinding); + String[] aliases = dataBinding.getAliases(); + if (aliases != null) { + for (String alias : aliases) { + bindings.put(alias.toLowerCase(), dataBinding); + } + } + } + + public DataBinding unregister(String id) { + if (id == null) { + return null; + } + DataBinding dataBinding = bindings.remove(id.toLowerCase()); + if (dataBinding != null) { + String[] aliases = dataBinding.getAliases(); + if (aliases != null) { + for (String alias : aliases) { + bindings.remove(alias.toLowerCase()); + } + } + } + return dataBinding; + } + + private Set getDataBindings() { + return new HashSet(bindings.values()); + } + + public boolean introspectType(DataType dataType, Annotation[] annotations) { + for (DataBinding binding : getDataBindings()) { + // don't introspect for JavaBeansDatabinding as all javatypes will + // anyways match to its basetype + // which is java.lang.Object. Default to this only if no databinding + // results + if (!binding.getName().equals(JavaBeansDataBinding.NAME)) { + if (binding.introspect(dataType, annotations)) { + return true; + } + } + } + // FIXME: Should we honor the databinding from operation/interface + // level? + Object physical = dataType.getPhysical(); + if (physical instanceof Class) { + if (physical == Object.class || Throwable.class.isAssignableFrom((Class)physical)) { + return false; + } + } + dataType.setDataBinding(JavaBeansDataBinding.NAME); + return false; + } + + public DataType introspectType(Object value) { + DataType dataType = null; + for (DataBinding binding : getDataBindings()) { + // don't introspect for JavaBeansDatabinding as all javatypes will + // anyways match to its basetype + // which is java.lang.Object. Default to this only if no databinding + // results + if (!binding.getName().equals(JavaBeansDataBinding.NAME)) { + dataType = binding.introspect(value); + } + if (dataType != null) { + return dataType; + } + } + return new DataType(JavaBeansDataBinding.NAME, value.getClass(), value.getClass()); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java new file mode 100644 index 0000000000..e687a161eb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java @@ -0,0 +1,157 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.impl; + +import java.util.Map; +import java.util.Set; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.ReferenceBinding; +import org.apache.tuscany.spi.component.SCAObject; +import org.apache.tuscany.spi.databinding.Mediator; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InboundInvocationChain; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.Interceptor; +import org.apache.tuscany.spi.wire.OutboundInvocationChain; +import org.apache.tuscany.spi.wire.OutboundWire; +import org.apache.tuscany.spi.wire.WirePostProcessorExtension; +import org.osoa.sca.annotations.Constructor; + +/** + * This processor is responsible to add an interceptor to invocation chain if the source and target operations have + * different databinding requirements + * + * @version $Rev$ $Date$ + */ +public class DataBindingWirePostProcessor extends WirePostProcessorExtension { + private Mediator mediator; + + @Constructor({"mediator"}) + public DataBindingWirePostProcessor(@Autowire Mediator mediator) { + super(); + this.mediator = mediator; + } + + public void process(OutboundWire source, InboundWire target) { + Map, OutboundInvocationChain> chains = source.getInvocationChains(); + for (Map.Entry, OutboundInvocationChain> entry : chains.entrySet()) { + Operation sourceOperation = entry.getKey(); + Operation targetOperation = + getTargetOperation(target.getInvocationChains().keySet(), sourceOperation.getName()); + String sourceDataBinding = sourceOperation.getDataBinding(); + String targetDataBinding = targetOperation.getDataBinding(); + if (sourceDataBinding == null && targetDataBinding == null) { + continue; + } + if (sourceDataBinding == null || targetDataBinding == null + || !sourceDataBinding.equals(targetDataBinding)) { + // Add the interceptor to the source side because multiple + // references can be wired + // to the same service + DataBindingInteceptor interceptor = + new DataBindingInteceptor(source, sourceOperation, targetOperation); + interceptor.setMediator(mediator); + entry.getValue().addInterceptor(0, interceptor); + } + } + + // Check if there's a callback + Map callbackOperations = source.getServiceContract().getCallbackOperations(); + if (callbackOperations == null || callbackOperations.isEmpty()) { + return; + } + Object targetAddress = source.getContainer().getName(); + Map, OutboundInvocationChain> callbackChains = + target.getSourceCallbackInvocationChains(targetAddress); + if (callbackChains == null) { + // callback chains could be null + return; + } + for (Map.Entry, OutboundInvocationChain> entry : callbackChains.entrySet()) { + Operation sourceOperation = entry.getKey(); + Operation targetOperation = + getTargetOperation(source.getTargetCallbackInvocationChains().keySet(), sourceOperation + .getName()); + String sourceDataBinding = sourceOperation.getDataBinding(); + String targetDataBinding = targetOperation.getDataBinding(); + if (sourceDataBinding == null && targetDataBinding == null) { + continue; + } + if (sourceDataBinding == null || targetDataBinding == null + || !sourceDataBinding.equals(targetDataBinding)) { + // Add the interceptor to the source side because multiple + // references can be wired + // to the same service + DataBindingInteceptor interceptor = + new DataBindingInteceptor(source, sourceOperation, targetOperation); + interceptor.setMediator(mediator); + entry.getValue().addInterceptor(0, interceptor); + } + } + } + + public void process(InboundWire source, OutboundWire target) { + SCAObject container = source.getContainer(); + // Either Service or Reference + boolean isReference = container instanceof ReferenceBinding; + + Map, InboundInvocationChain> chains = source.getInvocationChains(); + for (Map.Entry, InboundInvocationChain> entry : chains.entrySet()) { + Operation sourceOperation = entry.getKey(); + Operation targetOperation = + getTargetOperation(target.getInvocationChains().keySet(), sourceOperation.getName()); + String sourceDataBinding = sourceOperation.getDataBinding(); + String targetDataBinding = targetOperation.getDataBinding(); + if (sourceDataBinding == null && targetDataBinding == null) { + continue; + } + if (sourceDataBinding == null || targetDataBinding == null + || !sourceDataBinding.equals(targetDataBinding)) { + // Add the interceptor to the source side + DataBindingInteceptor interceptor = + new DataBindingInteceptor(source, sourceOperation, targetOperation); + interceptor.setMediator(mediator); + if (isReference) { + // FIXME: We need a better way to position the interceptors + target.getInvocationChains().get(targetOperation).addInterceptor(0, interceptor); + Interceptor tail = entry.getValue().getTailInterceptor(); + if (tail != null) { + // HACK to relink the bridging interceptor + tail.setNext(interceptor); + } + } else { + entry.getValue().addInterceptor(0, interceptor); + } + + } + } + } + + private Operation getTargetOperation(Set> operations, String operationName) { + for (Operation op : operations) { + if (op.getName().equals(operationName)) { + return op; + } + } + return null; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataTypeLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataTypeLoader.java new file mode 100644 index 0000000000..10731f8c53 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataTypeLoader.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.impl; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.InvalidValueException; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.loader.LoaderUtil; +import org.apache.tuscany.spi.model.DataType; +import org.apache.tuscany.spi.model.ModelObject; + +import org.osoa.sca.annotations.Constructor; + +/** + * The StAX loader for data type + */ +public class DataTypeLoader extends LoaderExtension { + public static final QName DATA_BINDING = + new QName("http://tuscany.apache.org/xmlns/sca/databinding/1.0", "databinding"); + + @Constructor({"registry"}) + public DataTypeLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + @Override + public QName getXMLType() { + return DATA_BINDING; + } + + public DataType load(CompositeComponent parent, + ModelObject object, XMLStreamReader reader, + DeploymentContext deploymentContext) throws XMLStreamException, LoaderException { + assert DATA_BINDING.equals(reader.getName()); + String name = reader.getAttributeValue(null, "name"); + LoaderUtil.skipToEndElement(reader); + if (name == null) { + throw new InvalidValueException("The 'name' attrbiute is required"); + } + DataType dataType = new DataType(name, Object.class, Object.class); + return dataType; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DirectedGraph.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DirectedGraph.java new file mode 100755 index 0000000000..02adf5860c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DirectedGraph.java @@ -0,0 +1,357 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.impl; + +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Directed, weighted graph + * + * @param The type of vertex object + * @param The type of edge object + */ +public class DirectedGraph { + private final Map vertices = new HashMap(); + + /** + * Key for the shortest path cache + */ + private final class VertexPair { + private Vertex source; + + private Vertex target; + + /** + * @param source + * @param target + */ + private VertexPair(Vertex source, Vertex target) { + super(); + this.source = source; + this.target = target; + } + + public boolean equals(Object object) { + if (!VertexPair.class.isInstance(object)) { + return false; + } + VertexPair pair = (VertexPair)object; + return source == pair.source && target == pair.target; + } + + public int hashCode() { + int x = source == null ? 0 : source.hashCode(); + int y = target == null ? 0 : target.hashCode(); + return x ^ y; + } + + } + + private final Map paths = new HashMap(); + + /** + * Vertex of a graph + */ + public final class Vertex { + private V value; + + // TODO: Do we want to support multiple edges for a vertex pair? If so, + // we should use a List instead of Map + private Map outEdges = new HashMap(); + + private Vertex(V value) { + this.value = value; + } + + public String toString() { + return "(" + value + ")"; + } + + public V getValue() { + return value; + } + + public Map getOutEdges() { + return outEdges; + } + + } + + /** + * An Edge connects two vertices in one direction + */ + public final class Edge { + private Vertex sourceVertex; + + private Vertex targetVertex; + + private E value; + + private int weight; + + public Edge(Vertex source, Vertex target, E value, int weight) { + this.sourceVertex = source; + this.targetVertex = target; + this.value = value; + this.weight = weight; + } + + public String toString() { + return sourceVertex + "->" + targetVertex + "[" + value + "," + weight + "]"; + } + + public E getValue() { + return value; + } + + public void setValue(E value) { + this.value = value; + } + + public Vertex getTargetVertex() { + return targetVertex; + } + + public void setTargetVertex(Vertex vertex) { + this.targetVertex = vertex; + } + + public int getWeight() { + return weight; + } + + public void setWeight(int weight) { + this.weight = weight; + } + + public Vertex getSourceVertex() { + return sourceVertex; + } + + public void setSourceVertex(Vertex sourceVertex) { + this.sourceVertex = sourceVertex; + } + } + + private final class Node implements Comparable { + + private long distance = Integer.MAX_VALUE; + + private Node previous; // NOPMD by rfeng on 9/26/06 9:17 PM + + private Vertex vertex; // NOPMD by rfeng on 9/26/06 9:17 PM + + private Node(Vertex vertex) { + this.vertex = vertex; + } + + public int compareTo(Node o) { + return (distance > o.distance) ? 1 : ((distance == o.distance) ? 0 : -1); + } + } + + public void addEdge(V source, V target, E edgeValue, int weight) { + Vertex s = getVertex(source); + if (s == null) { + s = new Vertex(source); + vertices.put(source, s); + } + Vertex t = getVertex(target); + if (t == null) { + t = new Vertex(target); + vertices.put(target, t); + } + Edge edge = new Edge(s, t, edgeValue, weight); + s.outEdges.put(t, edge); + } + + public Vertex getVertex(V source) { + Vertex s = vertices.get(source); + return s; + } + + public boolean removeEdge(V source, V target) { + Vertex s = getVertex(source); + if (s == null) { + return false; + } + + Vertex t = getVertex(target); + if (t == null) { + return false; + } + + return s.outEdges.remove(t) != null; + + } + + public Edge getEdge(Vertex source, Vertex target) { + return source.outEdges.get(target); + } + + public Edge getEdge(V source, V target) { + return getEdge(getVertex(source), getVertex(target)); + } + + /** + * Get the shortes path from the source vertex to the target vertex using + * Dijkstra's algorithm. If there's no path, null will be returned. If the + * source is the same as the target, it returns a path with empty edges with + * weight 0. + * + * @param sourceValue The value identifies the source + * @param targetValue The value identifies the target + * @return The shortest path + */ + public Path getShortestPath(V sourceValue, V targetValue) { + Vertex source = getVertex(sourceValue); + if (source == null) { + return null; + } + Vertex target = getVertex(targetValue); + if (target == null) { + return null; + } + + VertexPair pair = new VertexPair(source, target); + if (paths.containsKey(pair)) { + return paths.get(pair); + } + + // HACK: To support same vertex + if (source == target) { + Path path = new Path(); + Edge edge = getEdge(source, target); + if (edge != null) { + path.addEdge(edge); + } + paths.put(pair, path); + return path; + } + + Map nodes = new HashMap(); + for (Vertex v : vertices.values()) { + Node node = new Node(v); + if (v == source) { + node.distance = 0; + } + nodes.put(v, node); + } + + Set otherNodes = new HashSet(nodes.values()); + Set nodesOnPath = new HashSet(); + while (!otherNodes.isEmpty()) { + Node nextNode = extractMin(otherNodes); + if (nextNode.vertex == target) { + Path path = getPath(nextNode); + paths.put(pair, path); // Cache it + return path; + } + nodesOnPath.add(nextNode); + for (Edge edge : nextNode.vertex.outEdges.values()) { + Node adjacentNode = nodes.get(edge.targetVertex); + if (nextNode.distance + edge.weight < adjacentNode.distance) { + adjacentNode.distance = nextNode.distance + edge.weight; + adjacentNode.previous = nextNode; + } + } + } + paths.put(pair, null); // Cache it + return null; + } + + /** + * Searches for the vertex u in the vertex set Q that has the least d[u] + * value. That vertex is removed from the set Q and returned to the user. + * + * @param nodes + * @return + */ + private Node extractMin(Set nodes) { + Node node = Collections.min(nodes); + nodes.remove(node); + return node; + } + + /** + * The path between two vertices + */ + public final class Path { + private List edges = new LinkedList(); + + private int weight; + + public int getWeight() { + return weight; + } + + public List getEdges() { + return edges; + } + + public void addEdge(Edge edge) { + edges.add(0, edge); + weight += edge.weight; + } + + public String toString() { + return edges + ", " + weight; + } + } + + private Path getPath(Node t) { + if (t.distance == Integer.MAX_VALUE) { + return null; + } + Path path = new Path(); + Node u = t; + while (u.previous != null) { + Edge edge = getEdge(u.previous.vertex, u.vertex); + path.addEdge(edge); + u = u.previous; + } + return path; + } + + public String toString() { + StringBuffer sb = new StringBuffer(); + for (Vertex v : vertices.values()) { + sb.append(v.outEdges.values()).append("\n"); + } + return sb.toString(); + } + + public Map getVertices() { + return vertices; + } + + public void addGraph(DirectedGraph otherGraph) { + for (Vertex v : otherGraph.vertices.values()) { + for (Edge e : v.outEdges.values()) { + addEdge(e.sourceVertex.value, e.targetVertex.value, e.value, e.weight); + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Exception2ExceptionTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Exception2ExceptionTransformer.java new file mode 100644 index 0000000000..d1ef0cbd1a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Exception2ExceptionTransformer.java @@ -0,0 +1,126 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.impl; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.ExceptionHandler; +import org.apache.tuscany.spi.databinding.Mediator; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.apache.tuscany.spi.model.DataType; +import org.osoa.sca.annotations.Service; + +/** + * This is a special transformer to transform the exception from one IDL to the + * other one + */ +@Service(Transformer.class) +public class Exception2ExceptionTransformer extends TransformerExtension implements + PullTransformer { + + protected Mediator mediator; + + public Exception2ExceptionTransformer() { + super(); + } + + @Override + public String getSourceDataBinding() { + return DataBinding.IDL_FAULT; + } + + @Override + public String getTargetDataBinding() { + return DataBinding.IDL_FAULT; + } + + /** + * @param mediator the mediator to set + */ + @Autowire + public void setMediator(Mediator mediator) { + this.mediator = mediator; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType() + */ + @Override + protected Class getSourceType() { + return Exception.class; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType() + */ + @Override + protected Class getTargetType() { + return Exception.class; + } + + /** + * @see org.apache.tuscany.spi.databinding.Transformer#getWeight() + */ + public int getWeight() { + return 10000; + } + + @SuppressWarnings("unchecked") + public Exception transform(Exception source, TransformationContext context) { + DataType sourceType = context.getSourceDataType(); + + DataType targetType = context.getTargetDataType(); + + ExceptionHandler exceptionHandler = getExceptionHandler(sourceType); + if (exceptionHandler == null) { + return source; + } + + Object sourceFaultInfo = exceptionHandler.getFaultInfo(source); + Object targetFaultInfo = + mediator.mediate(sourceFaultInfo, sourceType.getLogical(), targetType.getLogical(), context.getMetadata()); + + ExceptionHandler targetHandler = getExceptionHandler(targetType); + + if (targetHandler != null) { + Exception targetException = + targetHandler.createException(targetType, source.getMessage(), targetFaultInfo, source.getCause()); + return targetException; + } + + // FIXME + return source; + + } + + private ExceptionHandler getExceptionHandler(DataType targetType) { + DataType targetFaultType = (DataType)targetType.getLogical(); + DataBinding targetDataBinding = + mediator.getDataBindingRegistry().getDataBinding(targetFaultType.getDataBinding()); + if (targetDataBinding == null) { + return null; + } + ExceptionHandler targetHandler = targetDataBinding.getExceptionHandler(); + return targetHandler; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Group2GroupTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Group2GroupTransformer.java new file mode 100644 index 0000000000..c774336f4c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Group2GroupTransformer.java @@ -0,0 +1,97 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.impl; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.databinding.Mediator; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.apache.tuscany.spi.model.DataType; +import org.osoa.sca.annotations.Service; + +/** + * This is a special transformer to transform the output from one IDL to the + * other one + */ +@Service(Transformer.class) +public class Group2GroupTransformer extends TransformerExtension implements + PullTransformer { + + protected Mediator mediator; + + /** + * @param wrapperHandler + */ + public Group2GroupTransformer() { + super(); + } + + /** + * @param mediator the mediator to set + */ + @Autowire + public void setMediator(Mediator mediator) { + this.mediator = mediator; + } + + @Override + public String getSourceDataBinding() { + return GroupDataBinding.NAME; + } + + @Override + public String getTargetDataBinding() { + return GroupDataBinding.NAME; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType() + */ + @Override + protected Class getSourceType() { + return Object.class; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType() + */ + @Override + protected Class getTargetType() { + return Object.class; + } + + /** + * @see org.apache.tuscany.spi.databinding.Transformer#getWeight() + */ + public int getWeight() { + return 10; + } + + @SuppressWarnings("unchecked") + public Object transform(Object source, TransformationContext context) { + DataType sourceType = context.getSourceDataType(); + DataType targetType = context.getTargetDataType(); + + return mediator.mediate(source, sourceType.getLogical(), targetType.getLogical(), context.getMetadata()); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/GroupDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/GroupDataBinding.java new file mode 100644 index 0000000000..6f56fbc2d5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/GroupDataBinding.java @@ -0,0 +1,97 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.impl; + +import java.lang.annotation.Annotation; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; + +import org.apache.tuscany.spi.databinding.extension.DataBindingExtension; +import org.apache.tuscany.spi.model.DataType; + +/** + * The base class for a special databinding which represents a group of other databindings + * + * @version $Rev$ $Date$ + */ +public abstract class GroupDataBinding extends DataBindingExtension { + public static final String NAME = "databinding:group"; + + /** + * Marker type is a java class or interface representing the data format. + */ + protected Class[] markerTypes; + + public GroupDataBinding(Class[] types) { + super(NAME, null, GroupDataBinding.class); + this.markerTypes = types; + } + + @SuppressWarnings("unchecked") + public boolean introspect(DataType type, Annotation[] annotations) { + if (markerTypes == null) { + return false; + } + Type physical = type.getPhysical(); + if (physical instanceof ParameterizedType) { + physical = ((ParameterizedType)physical).getRawType(); + } + if (!(physical instanceof Class)) { + return false; + } + Class cls = (Class)physical; + for (Class c : markerTypes) { + if (isTypeOf(c, cls)) { + type.setDataBinding(getDataBinding(c)); + type.setLogical(getLogical(cls, annotations)); + return true; + } + } + return false; + } + + /** + * Test if the given type is a subtype of the base type + * @param markerType + * @param type + * @return + */ + protected boolean isTypeOf(Class markerType, Class type) { + return markerType.isAssignableFrom(type); + } + + /** + * Derive the databinding name from a base class + * @param baseType + * @return + */ + protected String getDataBinding(Class baseType) { + return baseType.getName(); + } + + /** + * Get the logical type + * @param type The java type + * @param annotations + * @return + */ + protected abstract Object getLogical(Class type, Annotation[] annotations); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Input2InputTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Input2InputTransformer.java new file mode 100644 index 0000000000..3f3f49f0b8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Input2InputTransformer.java @@ -0,0 +1,201 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.impl; + +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.Mediator; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.WrapperHandler; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.apache.tuscany.spi.idl.ElementInfo; +import org.apache.tuscany.spi.idl.XMLType; +import org.apache.tuscany.spi.model.DataType; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.WrapperInfo; +import org.osoa.sca.annotations.Service; + +/** + * This is a special transformer to transform the input from one IDL to the + * other one + */ +@Service(Transformer.class) +public class Input2InputTransformer extends TransformerExtension implements + PullTransformer { + + protected Mediator mediator; + + public Input2InputTransformer() { + super(); + } + + @Override + public String getSourceDataBinding() { + return DataBinding.IDL_INPUT; + } + + @Override + public String getTargetDataBinding() { + return DataBinding.IDL_INPUT; + } + + /** + * @param mediator the mediator to set + */ + @Autowire + public void setMediator(Mediator mediator) { + this.mediator = mediator; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType() + */ + @Override + protected Class getSourceType() { + return Object[].class; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType() + */ + @Override + protected Class getTargetType() { + return Object[].class; + } + + /** + * @see org.apache.tuscany.spi.databinding.Transformer#getWeight() + */ + public int getWeight() { + return 10000; + } + + @SuppressWarnings("unchecked") + public Object[] transform(Object[] source, TransformationContext context) { + DataType>> sourceType = context.getSourceDataType(); + Operation sourceOp = (Operation)sourceType.getOperation(); + boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle(); + + WrapperHandler sourceWrapperHandler = null; + if (sourceWrapped) { + sourceWrapperHandler = getWapperHandler(sourceType.getOperation().getDataBinding(), true); + } + + DataType>> targetType = context.getTargetDataType(); + Operation targetOp = (Operation)targetType.getOperation(); + boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle(); + WrapperHandler targetWrapperHandler = null; + if (targetWrapped) { + targetWrapperHandler = getWapperHandler(targetType.getOperation().getDataBinding(), true); + } + + if ((!sourceWrapped) && targetWrapped) { + // Unwrapped --> Wrapped + WrapperInfo wrapper = targetOp.getWrapper(); + ElementInfo wrapperElement = wrapper.getInputWrapperElement(); + + // If the source can be wrapped, wrapped it first + if (sourceWrapperHandler != null) { + Object sourceWrapper = sourceWrapperHandler.create(wrapperElement, context); + for (int i = 0; i < source.length; i++) { + ElementInfo argElement = wrapper.getInputChildElements().get(i); + sourceWrapperHandler.setChild(sourceWrapper, i, argElement, source[0]); + } + } + Object targetWrapper = targetWrapperHandler.create(wrapperElement, context); + if (source == null) { + return new Object[] {targetWrapper}; + } + List> argTypes = wrapper.getUnwrappedInputType().getLogical(); + + for (int i = 0; i < source.length; i++) { + ElementInfo argElement = wrapper.getInputChildElements().get(i); + DataType argType = argTypes.get(i); + Object child = source[i]; + child = + mediator.mediate(source[i], sourceType.getLogical().get(i), argType, context + .getMetadata()); + targetWrapperHandler.setChild(targetWrapper, i, argElement, child); + } + return new Object[] {targetWrapper}; + } else if (sourceWrapped && (!targetWrapped)) { + // Wrapped to Unwrapped + Object sourceWrapper = source[0]; + // List childElements = sourceOp.getWrapper().getInputChildElements(); + Object[] target = null; + + targetWrapperHandler = getWapperHandler(targetType.getOperation().getDataBinding(), false); + if (targetWrapperHandler != null) { + ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement(); + // Object targetWrapper = + // targetWrapperHandler.create(wrapperElement, context); + DataType targetWrapperType = + new DataType(targetType.getOperation().getDataBinding(), Object.class, + new XMLType(wrapperElement)); + Object targetWrapper = + mediator.mediate(sourceWrapper, + sourceType.getLogical().get(0), + targetWrapperType, + context.getMetadata()); + target = targetWrapperHandler.getChildren(targetWrapper).toArray(); + } else { + Object[] sourceChildren = sourceWrapperHandler.getChildren(sourceWrapper).toArray(); + target = new Object[sourceChildren.length]; + for (int i = 0; i < sourceChildren.length; i++) { + DataType childType = + sourceOp.getWrapper().getUnwrappedInputType().getLogical().get(i); + target[i] = + mediator.mediate(sourceChildren[i], childType, targetType.getLogical().get(i), context + .getMetadata()); + } + } + return target; + } else { + // Assuming wrapper to wrapper conversion can be handled here as + // well + Object[] newArgs = new Object[source.length]; + for (int i = 0; i < source.length; i++) { + Object child = + mediator.mediate(source[i], sourceType.getLogical().get(i), targetType.getLogical() + .get(i), context.getMetadata()); + newArgs[i] = child; + } + return newArgs; + } + } + + private WrapperHandler getWapperHandler(String dataBindingId, boolean required) { + DataBinding dataBinding = mediator.getDataBindingRegistry().getDataBinding(dataBindingId); + WrapperHandler wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler(); + if (wrapperHandler == null && required) { + throw new TransformationException( + "No wrapper handler is provided for databinding: " + dataBindingId); + } + return wrapperHandler; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/MediatorImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/MediatorImpl.java new file mode 100644 index 0000000000..2b6d871472 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/MediatorImpl.java @@ -0,0 +1,185 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.impl; + +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.databinding.DataBindingRegistry; +import org.apache.tuscany.spi.databinding.DataPipe; +import org.apache.tuscany.spi.databinding.Mediator; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.PushTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.TransformerRegistry; +import org.apache.tuscany.spi.model.DataType; +import org.osoa.sca.annotations.Scope; + +/** + * Default Mediator implementation + */ +@Scope("COMPOSITE") +public class MediatorImpl implements Mediator { + + private DataBindingRegistry dataBindingRegistry; + + private TransformerRegistry transformerRegistry; + + @Autowire + public void setTransformerRegistry(TransformerRegistry transformerRegistry) { + this.transformerRegistry = transformerRegistry; + } + + /** + * @param dataBindingRegistry the dataBindingRegistry to set + */ + @Autowire + public void setDataBindingRegistry(DataBindingRegistry dataBindingRegistry) { + this.dataBindingRegistry = dataBindingRegistry; + } + + /** + * @see org.apache.tuscany.spi.databinding.Mediator#mediate(java.lang.Object, + * org.apache.tuscany.spi.model.DataType, + * org.apache.tuscany.spi.model.DataType, Map) + */ + @SuppressWarnings("unchecked") + public Object mediate(Object source, + DataType sourceDataType, + DataType targetDataType, + Map, Object> metadata) { + if (sourceDataType == null) { + sourceDataType = dataBindingRegistry.introspectType(source); + } + if (sourceDataType == null) { + return source; + } else if (sourceDataType.equals(targetDataType)) { + return source; + } + + List path = getTransformerChain(sourceDataType, targetDataType); + + Object result = source; + int size = path.size(); + int i = 0; + while (i < size) { + Transformer transformer = path.get(i); + TransformationContext context = + createTransformationContext(sourceDataType, targetDataType, size, i, transformer, metadata); + // the source and target type + if (transformer instanceof PullTransformer) { + // For intermediate node, set data type to null + result = ((PullTransformer)transformer).transform(result, context); + } else if (transformer instanceof PushTransformer) { + DataPipe dataPipe = (i < size - 1) ? (DataPipe)path.get(++i) : null; + ((PushTransformer)transformer).transform(result, dataPipe.getSink(), context); + result = dataPipe.getResult(); + } + i++; + } + + return result; + } + + private TransformationContext createTransformationContext(DataType sourceDataType, + DataType targetDataType, + int size, + int index, + Transformer transformer, + Map, Object> metadata) { + DataType sourceType = + (index == 0) ? sourceDataType : new DataType(transformer.getSourceDataBinding(), + Object.class, null); + DataType targetType = + (index == size - 1) ? targetDataType : new DataType(transformer.getTargetDataBinding(), + Object.class, null); + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + TransformationContext context = + new TransformationContextImpl(sourceType, targetType, classLoader, metadata); + return context; + } + + @SuppressWarnings("unchecked") + public void mediate(Object source, + Object target, + DataType sourceDataType, + DataType targetDataType, + Map, Object> metadata) { + if (source == null) { + // Shortcut for null value + return; + } + if (sourceDataType == null) { + sourceDataType = dataBindingRegistry.introspectType(source); + } + if (sourceDataType == null) { + return; + } else if (sourceDataType.equals(targetDataType)) { + return; + } + + List path = getTransformerChain(sourceDataType, targetDataType); + Object result = source; + int size = path.size(); + for (int i = 0; i < size; i++) { + Transformer transformer = path.get(i); + TransformationContext context = + createTransformationContext(sourceDataType, targetDataType, size, i, transformer, metadata); + + if (transformer instanceof PullTransformer) { + result = ((PullTransformer)transformer).transform(result, context); + } else if (transformer instanceof PushTransformer) { + DataPipe dataPipe = (i < size - 1) ? (DataPipe)path.get(++i) : null; + Object sink = dataPipe != null ? dataPipe.getSink() : target; + ((PushTransformer)transformer).transform(result, sink, context); + result = (dataPipe != null) ? dataPipe.getResult() : null; + } + } + } + + private List getTransformerChain(DataType sourceDataType, DataType targetDataType) { + String sourceId = sourceDataType.getDataBinding(); + String targetId = targetDataType.getDataBinding(); + List path = transformerRegistry.getTransformerChain(sourceId, targetId); + if (path == null) { + TransformationException ex = new TransformationException("No path found for the transformation"); + ex.addContextName("Source: " + sourceId); + ex.addContextName("Target: " + targetId); + throw ex; + } + return path; + } + + /** + * @return the dataBindingRegistry + */ + public DataBindingRegistry getDataBindingRegistry() { + return dataBindingRegistry; + } + + /** + * @return the transformerRegistry + */ + public TransformerRegistry getTransformerRegistry() { + return transformerRegistry; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Output2OutputTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Output2OutputTransformer.java new file mode 100644 index 0000000000..ef5798511a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Output2OutputTransformer.java @@ -0,0 +1,186 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.impl; + +import java.util.List; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.Mediator; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.WrapperHandler; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.apache.tuscany.spi.idl.ElementInfo; +import org.apache.tuscany.spi.idl.XMLType; +import org.apache.tuscany.spi.model.DataType; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.WrapperInfo; +import org.osoa.sca.annotations.Service; + +/** + * This is a special transformer to transform the output from one IDL to the + * other one + */ +@Service(Transformer.class) +public class Output2OutputTransformer extends TransformerExtension implements + PullTransformer { + + protected Mediator mediator; + + /** + * @param wrapperHandler + */ + public Output2OutputTransformer() { + super(); + } + + /** + * @param mediator the mediator to set + */ + @Autowire + public void setMediator(Mediator mediator) { + this.mediator = mediator; + } + + @Override + public String getSourceDataBinding() { + return DataBinding.IDL_OUTPUT; + } + + @Override + public String getTargetDataBinding() { + return DataBinding.IDL_OUTPUT; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType() + */ + @Override + protected Class getSourceType() { + return Object.class; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType() + */ + @Override + protected Class getTargetType() { + return Object.class; + } + + /** + * @see org.apache.tuscany.spi.databinding.Transformer#getWeight() + */ + public int getWeight() { + return 10; + } + + private WrapperHandler getWapperHandler(Operation operation) { + String dataBindingId; + dataBindingId = operation.getDataBinding(); + DataBinding dataBinding = mediator.getDataBindingRegistry().getDataBinding(dataBindingId); + WrapperHandler wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler(); + if (wrapperHandler == null) { + throw new TransformationException( + "No wrapper handler is provided for databinding: " + dataBindingId); + } + return wrapperHandler; + } + + private WrapperHandler getWapperHandler(String dataBindingId) { + DataBinding dataBinding = mediator.getDataBindingRegistry().getDataBinding(dataBindingId); + return dataBinding == null ? null : dataBinding.getWrapperHandler(); + } + + @SuppressWarnings("unchecked") + public Object transform(Object response, TransformationContext context) { + try { + DataType sourceType = context.getSourceDataType(); + Operation sourceOp = (Operation)sourceType.getOperation(); + boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle(); + WrapperHandler sourceWrapperHandler = null; + if (sourceWrapped) { + sourceWrapperHandler = getWapperHandler(sourceOp); + } + + DataType targetType = context.getTargetDataType(); + Operation targetOp = (Operation)targetType.getOperation(); + boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle(); + WrapperHandler targetWrapperHandler = null; + if (targetWrapped) { + targetWrapperHandler = getWapperHandler(targetOp); + } + + if ((!sourceWrapped) && targetWrapped) { + // Unwrapped --> Wrapped + WrapperInfo wrapper = targetOp.getWrapper(); + Object targetWrapper = + targetWrapperHandler.create(wrapper.getOutputWrapperElement(), context); + + List childElements = wrapper.getOutputChildElements(); + if (childElements.isEmpty()) { + // void output + return targetWrapper; + } + ElementInfo argElement = childElements.get(0); + DataType argType = wrapper.getUnwrappedOutputType(); + Object child = response; + child = mediator.mediate(response, sourceType.getLogical(), argType, context.getMetadata()); + targetWrapperHandler.setChild(targetWrapper, 0, argElement, child); + return targetWrapper; + } else if (sourceWrapped && (!targetWrapped)) { + // Wrapped to Unwrapped + Object sourceWrapper = response; + List childElements = sourceOp.getWrapper().getOutputChildElements(); + if (childElements.isEmpty()) { + // The void output + return null; + } + targetWrapperHandler = getWapperHandler(targetType.getLogical().getDataBinding()); + if (targetWrapperHandler != null) { + ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement(); + // Object targetWrapper = + // targetWrapperHandler.create(wrapperElement, context); + DataType targetWrapperType = + new DataType(targetType.getLogical().getDataBinding(), Object.class, + new XMLType(wrapperElement)); + Object targetWrapper = + mediator.mediate(sourceWrapper, sourceType.getLogical(), targetWrapperType, context + .getMetadata()); + return targetWrapperHandler.getChildren(targetWrapper).get(0); + } else { + Object child = sourceWrapperHandler.getChildren(sourceWrapper).get(0); + DataType childType = sourceOp.getWrapper().getUnwrappedOutputType(); + return mediator.mediate(child, childType, targetType.getLogical(), context.getMetadata()); + } + } else { + // FIXME: Do we want to handle wrapped to wrapped? + return mediator.mediate(response, sourceType.getLogical(), targetType.getLogical(), context + .getMetadata()); + } + } catch (Exception e) { + throw new TransformationException(e); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueInterceptor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueInterceptor.java new file mode 100644 index 0000000000..c891ff7a61 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueInterceptor.java @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.impl; + +import java.util.IdentityHashMap; +import java.util.Map; + +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.DataBindingRegistry; +import org.apache.tuscany.spi.model.DataType; +import org.apache.tuscany.spi.wire.Interceptor; +import org.apache.tuscany.spi.wire.Message; + +/** + * An interceptor to enforce pass-by-value semantics for remotable interfaces + * + * @version $Rev$ $Date$ + */ +public class PassByValueInterceptor implements Interceptor { + private DataBindingRegistry registry; + private DataBinding[] parameterDatabindings; + private DataBinding resultDataBinding; + + private Interceptor next; + + public PassByValueInterceptor(DataBindingRegistry registry) { + this.registry = registry; + } + + public Interceptor getNext() { + return next; + } + + public boolean isOptimizable() { + return false; + } + + public void setNext(Interceptor next) { + this.next = next; + } + + public Message invoke(Message msg) { + Object obj = msg.getBody(); + msg.setBody(copy((Object[])obj)); + Message result = getNext().invoke(msg); + + if (!result.isFault()) { + result.setBody(copy(result.getBody(), getResultDataBinding())); + } + return result; + } + + public Object[] copy(Object[] args) { + if (args == null) { + return null; + } + Object[] copiedArgs = new Object[args.length]; + Map map = new IdentityHashMap(); + for (int i = 0; i < args.length; i++) { + if (args[i] == null) { + copiedArgs[i] = null; + } else { + Object copiedArg = map.get(args[i]); + if (copiedArg != null) { + copiedArgs[i] = copiedArg; + } else { + DataBinding dataBinding = + (getParameterDatabindings() != null) ? getParameterDatabindings()[i] : null; + copiedArg = copy(args[i], dataBinding); + map.put(args[i], copiedArg); + copiedArgs[i] = copiedArg; + } + } + } + return copiedArgs; + } + + public Object copy(Object arg, DataBinding argDataBinding) { + if (arg == null) { + return null; + } + Object copiedArg; + if (argDataBinding != null) { + copiedArg = argDataBinding.copy(arg); + } else { + copiedArg = arg; + DataType dataType = registry.introspectType(arg); + if (dataType != null) { + DataBinding binding = registry.getDataBinding(dataType.getDataBinding()); + if (binding != null) { + copiedArg = binding.copy(arg); + } + } + // FIXME: What to do if it's not recognized? + } + return copiedArg; + } + + public DataBinding[] getParameterDatabindings() { + return parameterDatabindings; + } + + public void setParameterDatabindings(DataBinding[] dataBindings) { + this.parameterDatabindings = dataBindings; + } + + public DataBinding getResultDataBinding() { + return resultDataBinding; + } + + public void setResultDataBinding(DataBinding retDataBinding) { + this.resultDataBinding = retDataBinding; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java new file mode 100644 index 0000000000..a95b0ef073 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java @@ -0,0 +1,188 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.impl; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.ReferenceBinding; +import org.apache.tuscany.spi.component.ServiceBinding; +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.DataBindingRegistry; +import org.apache.tuscany.spi.extension.AtomicComponentExtension; +import org.apache.tuscany.spi.model.DataType; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InboundInvocationChain; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.OutboundWire; +import org.apache.tuscany.spi.wire.WirePostProcessorExtension; + +/** + * This processor is responsible for enforcing the pass-by-value semantics + * required of Remotable interfaces. This is done by adding a pass-by-value + * interceptor to the inbound invocation chain of a target if the target + * interface is Remotable. + * + * @version $Rev$ $Date$ + */ +public class PassByValueWirePostProcessor extends WirePostProcessorExtension { + + private DataBindingRegistry dataBindingRegistry; + + public PassByValueWirePostProcessor() { + super(); + } + + /** + * @param dataBindingRegistry the dataBindingRegistry to set + */ + @Autowire + public void setDataBindingRegistry(DataBindingRegistry dataBindingRegistry) { + this.dataBindingRegistry = dataBindingRegistry; + } + + public void process(OutboundWire source, InboundWire target) { + PassByValueInterceptor interceptor; + Operation targetOperation; + Operation sourceOperation; + DataBinding[] argsDataBindings; + DataBinding resultDataBinding; + + boolean implAllowsPBR = false; + boolean methodAllowsPBR = false; + + // if the source is a service binding or the target is a reference + // binding do no + // add interceptor since the bindings will ensure passbyvalue semantics + if (!(source.getContainer() instanceof ServiceBinding || target.getContainer() instanceof ReferenceBinding)) { + + if (target.getContainer() instanceof AtomicComponentExtension) { + implAllowsPBR = ((AtomicComponentExtension)target.getContainer()).isAllowsPassByReference(); + } + + Map, InboundInvocationChain> chains = target.getInvocationChains(); + for (Map.Entry, InboundInvocationChain> entry : chains.entrySet()) { + targetOperation = entry.getKey(); + methodAllowsPBR = false; + + if (target.getContainer() instanceof AtomicComponentExtension) { + methodAllowsPBR = + ((AtomicComponentExtension)target.getContainer()).getPassByReferenceMethods() + .contains(targetOperation.getName()); + } + + if (target.getServiceContract().isRemotable() && (!implAllowsPBR && !methodAllowsPBR)) { + sourceOperation = + getSourceOperation(source.getInvocationChains().keySet(), targetOperation.getName()); + + if (null != sourceOperation) { + argsDataBindings = getParameterDataBindings(sourceOperation); + resultDataBinding = getResultDataBinding(sourceOperation); + interceptor = new PassByValueInterceptor(dataBindingRegistry); + interceptor.setParameterDatabindings(argsDataBindings); + interceptor.setResultDataBinding(resultDataBinding); + source.getInvocationChains().get(sourceOperation).addInterceptor(0, interceptor); + /* + * tailInterceptor = + * source.getInvocationChains().get(sourceOperation).getTailInterceptor(); + * if (tailInterceptor != null) { + * tailInterceptor.setNext(passByValueInterceptor); } + */ + } + } + } + + // Check if there's a callback + Map callbackOperations = source.getServiceContract().getCallbackOperations(); + implAllowsPBR = false; + + if (callbackOperations != null && !callbackOperations.isEmpty()) { + if (source.getContainer() instanceof AtomicComponentExtension) { + implAllowsPBR = ((AtomicComponentExtension)source.getContainer()).isAllowsPassByReference(); + } + + Object targetAddress = source.getContainer().getName(); + Map, InboundInvocationChain> callbackChains = source.getTargetCallbackInvocationChains(); + for (Map.Entry, InboundInvocationChain> entry : callbackChains.entrySet()) { + targetOperation = entry.getKey(); + methodAllowsPBR = false; + + if (source.getContainer() instanceof AtomicComponentExtension) { + methodAllowsPBR = + ((AtomicComponentExtension)source.getContainer()).getPassByReferenceMethods() + .contains(targetOperation.getName()); + } + + if (source.getServiceContract().isRemotable() && (!implAllowsPBR && !methodAllowsPBR)) { + sourceOperation = + getSourceOperation(target.getSourceCallbackInvocationChains(targetAddress).keySet(), + targetOperation.getName()); + + argsDataBindings = getParameterDataBindings(targetOperation); + resultDataBinding = getResultDataBinding(targetOperation); + + interceptor = new PassByValueInterceptor(dataBindingRegistry); + interceptor.setParameterDatabindings(argsDataBindings); + interceptor.setResultDataBinding(resultDataBinding); + + entry.getValue().addInterceptor(0, interceptor); + /* + * tailInterceptor = + * target.getSourceCallbackInvocationChains(targetAddress).get(sourceOperation) + * .getTailInterceptor(); if (tailInterceptor != null) { + * tailInterceptor.setNext(passByValueInterceptor); } + */ + } + } + } + } + } + + public void process(InboundWire source, OutboundWire target) { + // to be done if required.. + } + + private Operation getSourceOperation(Set> operations, String operationName) { + for (Operation op : operations) { + if (op.getName().equals(operationName)) { + return op; + } + } + return null; + } + + @SuppressWarnings("unchecked") + private DataBinding[] getParameterDataBindings(Operation operation) { + List> argumentTypes = (List>)operation.getInputType().getLogical(); + DataBinding[] argDataBindings = new DataBinding[argumentTypes.size()]; + int count = 0; + for (DataType argType : argumentTypes) { + argDataBindings[count++] = dataBindingRegistry.getDataBinding(argType.getDataBinding()); + } + return argDataBindings; + } + + private DataBinding getResultDataBinding(Operation operation) { + DataType resultType = (DataType)operation.getOutputType(); + return dataBindingRegistry.getDataBinding(resultType.getDataBinding()); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PipedTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PipedTransformer.java new file mode 100755 index 0000000000..388ea710a7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PipedTransformer.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.impl; + +import org.apache.tuscany.spi.databinding.DataPipe; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.PushTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; + +/** + * A utility class to connect PushTransformer and DataPipe to create a + * PullTransformer + * + * @param Source type + * @param Intermidate type + * @param Result type + */ +public class PipedTransformer implements PullTransformer { + private PushTransformer pusher; + + private DataPipe pipe; + + /** + * @param pumper + * @param pipe + */ + public PipedTransformer(PushTransformer pumper, DataPipe pipe) { + super(); + this.pusher = pumper; + this.pipe = pipe; + } + + public R transform(S source, TransformationContext context) { + pusher.transform(source, pipe.getSink(), context); + return pipe.getResult(); + } + + public String getSourceDataBinding() { + return pusher.getSourceDataBinding(); + } + + public String getTargetDataBinding() { + return pipe.getTargetDataBinding(); + } + + public int getWeight() { + return pusher.getWeight() + pipe.getWeight(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/SimpleDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/SimpleDataBinding.java new file mode 100644 index 0000000000..b1550c9f0a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/SimpleDataBinding.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.impl; + +import org.osoa.sca.annotations.Property; + +import org.apache.tuscany.spi.databinding.extension.DataBindingExtension; +import org.apache.tuscany.spi.loader.MissingResourceException; + +/** + * Simple databinding represented by a base java type. A SCDL property className is used to customize this component. + *

+ * The following illustrates how a simple data binding can be registered as a SCA component. + *

+ *

+ * <component name="databinding.MyDataBinding">
+ *   <system:implementation.java + * class="org.apache.tuscany.databinding.impl.SimpleDataBinding"/>
+ *   <property name="className">my.Type</property>
+ * </component> + *
+ * + * @version $Rv$ $Date$ + */ +public class SimpleDataBinding extends DataBindingExtension { + + public SimpleDataBinding(@Property(name = "className")String className) throws MissingResourceException { + super(resolve(className)); + } + + private static Class resolve(String className) throws MissingResourceException { + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + try { + return Class.forName(className, false, classLoader); + } catch (ClassNotFoundException e) { + classLoader = SimpleDataBinding.class.getClassLoader(); + try { + return Class.forName(className, false, classLoader); + } catch (ClassNotFoundException e1) { + throw new MissingResourceException(className, e1); + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/TransformationContextImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/TransformationContextImpl.java new file mode 100755 index 0000000000..47f340097b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/TransformationContextImpl.java @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.impl; + +import java.lang.ref.WeakReference; +import java.util.HashMap; +import java.util.Map; + +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.model.DataType; + +public class TransformationContextImpl implements TransformationContext { + private DataType sourceDataType; + + private DataType targetDataType; + + private final Map, Object> metadata = new HashMap, Object>(); + + private WeakReference classLoaderRef; + + public TransformationContextImpl() { + super(); + setClassLoader(Thread.currentThread().getContextClassLoader()); + } + + public TransformationContextImpl(DataType sourceDataType, + DataType targetDataType, + ClassLoader classLoader, + Map, Object> metadata) { + super(); + this.sourceDataType = sourceDataType; + this.targetDataType = targetDataType; + setClassLoader(classLoader); + if (metadata != null) { + this.metadata.putAll(metadata); + } + } + + public DataType getSourceDataType() { + return sourceDataType; + } + + public DataType getTargetDataType() { + return targetDataType; + } + + public void setSourceDataType(DataType sourceDataType) { + this.sourceDataType = sourceDataType; + } + + public void setTargetDataType(DataType targetDataType) { + this.targetDataType = targetDataType; + } + + public final void setClassLoader(ClassLoader classLoader) { + this.classLoaderRef = new WeakReference(classLoader); + } + + public ClassLoader getClassLoader() { + return classLoaderRef.get(); + } + + public Map, Object> getMetadata() { + return metadata; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/TransformerRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/TransformerRegistryImpl.java new file mode 100755 index 0000000000..6f5c6d0e73 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/TransformerRegistryImpl.java @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.osoa.sca.annotations.EagerInit; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.DataBindingRegistry; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.TransformerRegistry; + +/** + * @version $Rev$ $Date$ + */ +@EagerInit +public class TransformerRegistryImpl implements TransformerRegistry { + private DataBindingRegistry dataBindingRegistry; + + private final DirectedGraph graph = new DirectedGraph(); + + public void registerTransformer(String sourceType, String resultType, int weight, Transformer transformer) { + graph.addEdge(sourceType, resultType, transformer, weight); + } + + public void registerTransformer(Transformer transformer) { + graph.addEdge(transformer.getSourceDataBinding(), + transformer.getTargetDataBinding(), + transformer, + transformer.getWeight()); + } + + public boolean unregisterTransformer(String sourceType, String resultType) { + return graph.removeEdge(sourceType, resultType); + } + + public Transformer getTransformer(String sourceType, String resultType) { + DirectedGraph.Edge edge = graph.getEdge(sourceType, resultType); + return (edge == null) ? null : edge.getValue(); + } + + public List getTransformerChain(String sourceType, String resultType) { + String source = normalize(sourceType); + String result = normalize(resultType); + List transformers = new ArrayList(); + DirectedGraph.Path path = graph.getShortestPath(source, result); + if (path == null) { + return null; + } + for (DirectedGraph.Edge edge : path.getEdges()) { + transformers.add(edge.getValue()); + } + return transformers; + } + + public String toString() { + return graph.toString(); + } + + /** + * @param dataBindingRegistry the dataBindingRegistry to set + */ + @Autowire + public void setDataBindingRegistry(DataBindingRegistry dataBindingRegistry) { + this.dataBindingRegistry = dataBindingRegistry; + } + + /** + * Normalize the id to a name of a data binding as databindings may have aliases + * @param id + * @return + */ + private String normalize(String id) { + if (dataBindingRegistry != null) { + DataBinding dataBinding = dataBindingRegistry.getDataBinding(id); + return dataBinding == null ? id : dataBinding.getName(); + } else { + return id; + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/DOMNode2JavaBeanTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/DOMNode2JavaBeanTransformer.java new file mode 100644 index 0000000000..80f9fa04da --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/DOMNode2JavaBeanTransformer.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.javabeans; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.spi.databinding.Transformer; +import org.osoa.sca.annotations.Service; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * Transformer to convert data from DOM Node to JavaBean + */ +@Service(Transformer.class) +public class DOMNode2JavaBeanTransformer extends XML2JavaBeanTransformer { + + @Override + public Node getRootElement(Node element) throws XML2JavaMapperException { + if (element instanceof Document) { + return ((Document)element).getDocumentElement(); + } else { + return element; + } + + } + + @Override + public List getChildElements(Node parent) throws XML2JavaMapperException { + NodeList nodeList = parent.getChildNodes(); + List nodeArrayList = new ArrayList(nodeList.getLength()); + for (int count = 0; count < nodeList.getLength(); ++count) { + nodeArrayList.add(nodeList.item(count)); + } + + return nodeArrayList; + } + + @Override + public String getElementName(Node element) throws XML2JavaMapperException { + return element.getLocalName(); + } + + @Override + public String getText(Node element) throws XML2JavaMapperException { + if (element instanceof Document) { + element = ((Document)element).getDocumentElement(); + } + return element.getTextContent(); + } + + @Override + public boolean isTextElement(Node element) throws XML2JavaMapperException { + return element.getNodeType() == Node.TEXT_NODE; + } + + public Class getSourceType() { + return Node.class; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/Java2XMLMapperException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/Java2XMLMapperException.java new file mode 100644 index 0000000000..3f88a4ee89 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/Java2XMLMapperException.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.javabeans; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.api.TuscanyRuntimeException; + +/** + * This exception is used to encapsulate and rethrow exceptions that arise out + * of converting JavaBean objects to XML + */ +public class Java2XMLMapperException extends TuscanyRuntimeException { + private static final long serialVersionUID = 6811924384399578686L; + + private QName xmlElementName; + private String javaFieldName; + private Class javaType; + + public Java2XMLMapperException(String message) { + super(message); + } + + public Java2XMLMapperException(Throwable cause) { + super(cause); + } + + public String getJavaFieldName() { + return javaFieldName; + } + + public void setJavaFieldName(String javaFieldName) { + this.javaFieldName = javaFieldName; + } + + public Class getJavaType() { + return javaType; + } + + public void setJavaType(Class javaType) { + this.javaType = javaType; + } + + public QName getXmlElementName() { + return xmlElementName; + } + + public void setXmlElementName(QName xmlElementName) { + this.xmlElementName = xmlElementName; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2DOMNodeTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2DOMNodeTransformer.java new file mode 100644 index 0000000000..5925e87b69 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2DOMNodeTransformer.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.javabeans; + +import javax.xml.namespace.QName; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.DOMHelper; +import org.osoa.sca.annotations.Service; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +/** + * Transformer to convert data from a JavaBean object to DOM Node + */ +@Service(Transformer.class) +public class JavaBean2DOMNodeTransformer extends JavaBean2XMLTransformer { + + public static final String COLON = ":"; + private Document factory; + + public JavaBean2DOMNodeTransformer() { + super(); + try { + factory = DOMHelper.newDocument(); + } catch (ParserConfigurationException e) { + throw new Java2XMLMapperException(e); + } + } + + @Override + public void appendChild(Node parentElement, Node childElement) throws Java2XMLMapperException { + parentElement.appendChild(childElement); + } + + @Override + public Node createElement(QName qName) throws Java2XMLMapperException { + String qualifedName = + (qName.getPrefix() == null || qName.getPrefix().length() <= 0) ? qName.getLocalPart() + : qName.getPrefix() + COLON + qName.getLocalPart(); + return factory.createElementNS(qName.getNamespaceURI(), qualifedName); + } + + @Override + public Node createText(String textData) throws Java2XMLMapperException { + return factory.createTextNode(textData); + } + + public Class getTargetType() { + return Node.class; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2XMLStreamReader.java new file mode 100644 index 0000000000..770c8e7254 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2XMLStreamReader.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.javabeans; + +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.core.databinding.xml.BeanUtil; +import org.apache.tuscany.core.databinding.xml.XMLDocumentStreamReader; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; + +@Service(Transformer.class) +public class JavaBean2XMLStreamReader extends TransformerExtension implements + PullTransformer { + + public XMLStreamReader transform(Object source, TransformationContext context) { + try { + return new XMLDocumentStreamReader(BeanUtil.getXMLStreamReader(source)); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return Object.class; + } + + public Class getTargetType() { + return XMLStreamReader.class; + } + + public int getWeight() { + return 50; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2XMLTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2XMLTransformer.java new file mode 100644 index 0000000000..c0199eee95 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2XMLTransformer.java @@ -0,0 +1,226 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.javabeans; + +import java.lang.reflect.Array; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.Date; +import java.util.GregorianCalendar; + +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; + +/** + * Transformer to convert data from a JavaBean object to xml + */ +@Service(Transformer.class) +public abstract class JavaBean2XMLTransformer extends TransformerExtension implements + PullTransformer { + + public static final String GET = "get"; + public static final String PREFIX = "n"; + public static final String PERIOD = "."; + public static final String FWD_SLASH = "/"; + public static final String HTTP = "http://"; + private static int prefixCount = 1; + + protected SimpleTypeMapperExtension mapper; + + public JavaBean2XMLTransformer() { + this.mapper = new SimpleTypeMapperExtension(); + } + + public T transform(Object source, TransformationContext context) { + QName rootElementName = (QName)context.getTargetDataType().getMetadata("RootElementName"); + if (rootElementName == null) { + rootElementName = new QName(resolveRootElementName(source.getClass())); + } + T root = createElement(rootElementName); + appendChildElements(root, + resolveElementName(source.getClass()), + source.getClass(), + source, + context); + return root; + } + + private void appendChildElements(T parent, + QName elementName, + Class javaType, + Object javaObject, + TransformationContext context) { + T element = null; + if (javaObject != null) { + if (javaType.isPrimitive() || isSimpleJavaType(javaObject)) { + appendChild(parent, createText(mapper.toXMLLiteral(null, javaObject, context))); + } else if (javaType.isArray()) { + boolean arrayDone = false; + Object arrayObject = null; + for (int count = 0; !arrayDone; ++count) { + try { + arrayObject = Array.get(javaObject, count); + element = createElement(elementName); + appendChild(parent, element); + appendChildElements(element, + elementName, + javaType.getComponentType(), + arrayObject, + context); + } catch (ArrayIndexOutOfBoundsException e1) { + arrayDone = true; + } + } + } else { + Field[] javaFields = javaType.getFields(); + for (Field aField : javaFields) { + try { + QName fieldElementName = new QName(aField.getName()); + if (!aField.getType().isArray()) { + element = createElement(fieldElementName); + appendChild(parent, element); + appendChildElements(element, + fieldElementName, + aField.getType(), + aField.get(javaObject), + context); + } else { + appendChildElements(parent, + fieldElementName, + aField.getType(), + aField.get(javaObject), + context); + } + } catch (IllegalAccessException e) { + Java2XMLMapperException java2xmlEx = new Java2XMLMapperException(e); + java2xmlEx.setJavaFieldName(aField.getName()); + java2xmlEx.setJavaType(javaType); + throw java2xmlEx; + } + } + + Method[] methods = javaType.getDeclaredMethods(); + String fieldName = null; + for (Method aMethod : methods) { + try { + if (Modifier.isPublic(aMethod.getModifiers()) && aMethod.getName().startsWith(GET) + && aMethod.getParameterTypes().length == 0) { + fieldName = resolveFieldFromMethod(aMethod.getName()); + try { + javaType.getField(fieldName); + } catch (NoSuchFieldException e) { + QName fieldElementName = new QName(fieldName); + if (aMethod.getReturnType().isArray()) { + appendChildElements(parent, fieldElementName, aMethod.getReturnType(), aMethod + .invoke(javaObject, new Object[0]), context); + } else { + element = createElement(fieldElementName); + appendChild(parent, element); + appendChildElements(element, fieldElementName, aMethod.getReturnType(), aMethod + .invoke(javaObject, new Object[0]), context); + } + } + } + } catch (IllegalAccessException e) { + Java2XMLMapperException java2xmlEx = new Java2XMLMapperException(e); + java2xmlEx.setJavaFieldName(fieldName); + java2xmlEx.setJavaType(javaType); + throw java2xmlEx; + } catch (InvocationTargetException e) { + Java2XMLMapperException java2xmlEx = new Java2XMLMapperException(e); + java2xmlEx.setJavaFieldName(fieldName); + java2xmlEx.setJavaType(javaType); + throw java2xmlEx; + } + } + } + } + } + + public Class getSourceType() { + return Object.class; + } + + private boolean isSimpleJavaType(Object javaObject) { + if (javaObject instanceof String) { + return true; + } + if (javaObject instanceof Byte || javaObject instanceof Character + || javaObject instanceof Short + || javaObject instanceof Integer + || javaObject instanceof Long + || javaObject instanceof Float + || javaObject instanceof Double) { + return true; + } + if (javaObject instanceof GregorianCalendar || javaObject instanceof Date + || javaObject instanceof XMLGregorianCalendar + || javaObject instanceof byte[] + || javaObject instanceof QName) { + return true; + } + return false; + } + + private String resolveRootElementName(Class javaType) { + if (javaType.isArray()) { + return javaType.getComponentType().getSimpleName() + "_collection"; + } else { + return javaType.getSimpleName() + "_instance"; + } + } + + + private QName resolveElementName(Class javaType) { + if (javaType.isArray()) { + return new QName(javaType.getComponentType().getSimpleName()); + } else { + return new QName(javaType.getSimpleName()); + } + } + + private String resolveFieldFromMethod(String methodName) { + StringBuffer fieldName = new StringBuffer(); + fieldName.append(Character.toLowerCase(methodName.charAt(GET.length()))); + fieldName.append(methodName.substring(GET.length() + 1)); + return fieldName.toString(); + } + + public String getNexPrefix() { + return PREFIX + prefixCount++; + } + + @Override + public int getWeight() { + return JavaBeansDataBinding.HEAVY_WEIGHT; + } + + public abstract T createElement(QName qName) throws Java2XMLMapperException; + public abstract T createText(String textData) throws Java2XMLMapperException; + public abstract void appendChild(T parentElement, T childElement) throws Java2XMLMapperException; +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBeansDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBeansDataBinding.java new file mode 100644 index 0000000000..58c3728202 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBeansDataBinding.java @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.javabeans; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectStreamClass; +import java.io.OutputStream; +import java.io.Serializable; + +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.extension.DataBindingExtension; +import org.osoa.sca.annotations.Service; + +/** + * DataBinding for JavaBeans + */ +@Service(DataBinding.class) +public class JavaBeansDataBinding extends DataBindingExtension { + /** + * Defining a weight to a very high number so that the transformer won't be picked + * up by other paths unless it's the only available path + */ + public static final int HEAVY_WEIGHT = 10000; + public static final String NAME = Object.class.getName(); + + public JavaBeansDataBinding() { + super(NAME, Object.class); + } + + public Object copy(Object arg) { + if (arg == null) { + return null; + } + final Class clazz = arg.getClass(); + if (String.class == clazz || clazz.isPrimitive() + || Number.class.isAssignableFrom(clazz) + || Boolean.class.isAssignableFrom(clazz) + || Character.class.isAssignableFrom(clazz) + || Byte.class.isAssignableFrom(clazz)) { + // Immutable classes + return arg; + } + try { + if (arg instanceof Serializable) { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = getObjectOutputStream(bos); + oos.writeObject(arg); + oos.close(); + bos.close(); + + ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + ObjectInputStream ois = getObjectInputStream(bis, clazz.getClassLoader()); + Object objectCopy = ois.readObject(); + ois.close(); + bis.close(); + return objectCopy; + } else { + // return arg; + throw new IllegalArgumentException("Pass-by-value is not supported for the given object"); + } + } catch (Exception e) { + throw new IllegalArgumentException("Pass-by-value is not supported for the given object", e); + } + } + + protected ObjectOutputStream getObjectOutputStream(OutputStream os) throws IOException { + return new ObjectOutputStream(os); + } + + protected ObjectInputStream getObjectInputStream(InputStream is, final ClassLoader cl) throws IOException { + ObjectInputStream ois = new ObjectInputStream(is) { + @Override + protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { + try { + return Class.forName(desc.getName(), false, cl); + } catch (ClassNotFoundException e) { + return super.resolveClass(desc); + } + } + + }; + return ois; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/XML2JavaBeanTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/XML2JavaBeanTransformer.java new file mode 100644 index 0000000000..2013502851 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/XML2JavaBeanTransformer.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.javabeans; + +import java.lang.reflect.Array; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.apache.tuscany.spi.idl.ElementInfo; +import org.apache.tuscany.spi.idl.TypeInfo; +import org.apache.tuscany.spi.idl.XMLType; +import org.osoa.sca.annotations.Service; + +/** + * Transformer to convert data from XML to JavaBean + */ +@Service(Transformer.class) +public abstract class XML2JavaBeanTransformer extends TransformerExtension implements + PullTransformer { + + public static final String SET = "set"; + + protected SimpleTypeMapperExtension mapper; + + public XML2JavaBeanTransformer() { + this.mapper = new SimpleTypeMapperExtension(); + } + + @Override + public int getWeight() { + return JavaBeansDataBinding.HEAVY_WEIGHT; + } + + public Object transform(T source, TransformationContext context) { + XMLType xmlType = (XMLType) context.getSourceDataType().getLogical(); + return toJavaObject(xmlType.getTypeName(), getRootElement(source), context); + } + + public Object toJavaObject(QName xmlType, T xmlElement, TransformationContext context) { + if (SimpleTypeMapperExtension.isSimpleXSDType(xmlType)) { + return mapper.toJavaObject(xmlType, getText(xmlElement), context); + } else { + Class javaType = (Class)context.getTargetDataType().getPhysical(); + return createJavaObject(xmlElement, javaType, context); + } + } + + @SuppressWarnings("unchecked") + private L createJavaObject(T element, Class javaType, TransformationContext context) + throws XML2JavaMapperException { + List childElements = getChildElements(element); + if (childElements.size() == 1 && isTextElement(childElements.get(0))) { + return (L) mapper.toJavaObject(mapper.getXMLType(javaType).getQName(), + getText(childElements.get(0)), + context); + } else { + String fieldName = null; + try { + L javaInstance = javaType.newInstance(); + Map> arrayFields = new Hashtable>(); + Map> arraySetters = new Hashtable>(); + for (int count = 0; count < childElements.size(); ++count) { + if (!isTextElement(childElements.get(count))) { + fieldName = getElementName(childElements.get(count)); + try { + Field javaField = javaType.getField(fieldName); + setFieldValue(javaInstance, + javaField, + childElements.get(count), + arrayFields, + context); + + } catch (NoSuchFieldException e1) { + setFieldValueUsingSetter(javaType, + javaInstance, + fieldName, + childElements.get(count), + arraySetters, + context); + } + } + } + + setArrayValues(javaInstance, arrayFields, arraySetters); + return javaInstance; + } catch (Exception e2) { + XML2JavaMapperException xml2JavaEx = new XML2JavaMapperException(e2); + xml2JavaEx.setJavaType(javaType); + xml2JavaEx.setJavaFieldName(fieldName); + throw xml2JavaEx; + } + } + } + + private void setFieldValue(Object javaInstance, + Field javaField, + T fieldValue, + Map> arrayFields, + TransformationContext context) throws IllegalAccessException { + Class javaFieldType = (Class) javaField.getType(); + + if (javaFieldType.isArray()) { + Class componentType = javaFieldType.getComponentType(); + List fldValueArray = arrayFields.get(javaField); + if (fldValueArray == null) { + fldValueArray = new ArrayList(); + arrayFields.put(javaField, fldValueArray); + } + fldValueArray.add(createJavaObject(fieldValue, componentType, context)); + } else { + javaField.setAccessible(true); + javaField.set(javaInstance, createJavaObject(fieldValue, javaFieldType, context)); + } + } + + private void setFieldValueUsingSetter(Class javaType, + Object javaInstance, + String fieldName, + T fieldValue, + Map> arraySetters, + TransformationContext context) throws IllegalAccessException, + InvocationTargetException { + char firstChar = Character.toUpperCase(fieldName.charAt(0)); + StringBuilder methodName = new StringBuilder(SET + fieldName); + methodName.setCharAt(SET.length(), firstChar); + boolean methodNotFound = true; + + for (int methodCount = 0; methodNotFound && methodCount < javaType.getMethods().length; ++methodCount) { + Method aMethod = javaType.getMethods()[methodCount]; + if (aMethod.getName().equals(methodName.toString()) + && aMethod.getParameterTypes().length == 1) { + Class paramType = aMethod.getParameterTypes()[0]; + + if (paramType.isArray()) { + Class componentType = paramType.getComponentType(); + List setterValueArray = arraySetters.get(aMethod); + if (setterValueArray == null) { + setterValueArray = new ArrayList(); + arraySetters.put(aMethod, setterValueArray); + } + setterValueArray.add(createJavaObject(fieldValue, componentType, context)); + } else { + aMethod.invoke(javaInstance, new Object[] {createJavaObject(fieldValue, + paramType, + context)}); + } + methodNotFound = false; + } + } + + if (methodNotFound) { + XML2JavaMapperException xml2JavaEx = + new XML2JavaMapperException("No field or setter method to configure xml data"); + xml2JavaEx.setJavaFieldName(fieldName); + xml2JavaEx.setJavaType(javaType); + throw xml2JavaEx; + } + } + + private void setArrayValues(Object javaInstance, + Map> arrayFields, + Map> arraySetters) throws IllegalAccessException, + InvocationTargetException { + if (arrayFields.size() > 0) { + for (Field javaField : arrayFields.keySet()) { + javaField.setAccessible(true); + + if (javaField.getType().getComponentType().isPrimitive()) { + javaField.set(javaInstance, createPrimitiveArray(javaField.getType() + .getComponentType(), + arrayFields.get(javaField))); + } else { + javaField.set(javaInstance, + createNonPrimitiveArray(javaField.getType().getComponentType(), + arrayFields.get(javaField))); + } + } + } + + if (arraySetters.size() > 0) { + for (Method aMethod : arraySetters.keySet()) { + Class paramType = aMethod.getParameterTypes()[0]; + if (paramType.getComponentType().isPrimitive()) { + aMethod.invoke(javaInstance, + new Object[] {createPrimitiveArray(paramType.getComponentType(), + arraySetters.get(aMethod))}); + } else { + aMethod.invoke(javaInstance, + new Object[] {createNonPrimitiveArray(paramType.getComponentType(), + arraySetters.get(aMethod))}); + } + } + } + } + + private Object createNonPrimitiveArray(Class fieldType, List values) { + Object objectArray = Array.newInstance(fieldType, values.size()); + for (int count = 0; count < values.size(); ++count) { + Array.set(objectArray, count, values.get(count)); + } + return objectArray; + } + + private Object createPrimitiveArray(Class fieldType, List values) { + if (fieldType.isPrimitive()) { + if (fieldType.getName().equals("int")) { + int[] primitiveValues = new int[values.size()]; + for (int count = 0; count < values.size(); ++count) { + primitiveValues[count] = ((Integer) values.get(count)).intValue(); + } + return primitiveValues; + } else if (fieldType.getName().equals("float")) { + float[] primitiveValues = new float[values.size()]; + for (int count = 0; count < values.size(); ++count) { + primitiveValues[count] = ((Float) values.get(count)).floatValue(); + } + return primitiveValues; + } else if (fieldType.getName().equals("boolean")) { + boolean[] primitiveValues = new boolean[values.size()]; + for (int count = 0; count < values.size(); ++count) { + primitiveValues[count] = ((Boolean) values.get(count)).booleanValue(); + } + return primitiveValues; + } else if (fieldType.getName().equals("char")) { + char[] primitiveValues = new char[values.size()]; + for (int count = 0; count < values.size(); ++count) { + primitiveValues[count] = ((Character) values.get(count)).charValue(); + } + return primitiveValues; + } else if (fieldType.getName().equals("byte")) { + byte[] primitiveValues = new byte[values.size()]; + for (int count = 0; count < values.size(); ++count) { + primitiveValues[count] = ((Byte) values.get(count)).byteValue(); + } + return primitiveValues; + } else if (fieldType.getName().equals("short")) { + short[] primitiveValues = new short[values.size()]; + for (int count = 0; count < values.size(); ++count) { + primitiveValues[count] = ((Short) values.get(count)).shortValue(); + } + return primitiveValues; + } else if (fieldType.getName().equals("long")) { + long[] primitiveValues = new long[values.size()]; + for (int count = 0; count < values.size(); ++count) { + primitiveValues[count] = ((Long) values.get(count)).longValue(); + } + return primitiveValues; + } else if (fieldType.getName().equals("double")) { + double[] primitiveValues = new double[values.size()]; + for (int count = 0; count < values.size(); ++count) { + primitiveValues[count] = ((Double) values.get(count)).doubleValue(); + } + return primitiveValues; + } + } + return values; + } + + public abstract String getText(T source) throws XML2JavaMapperException; + + public abstract List getChildElements(T parent) throws XML2JavaMapperException; + + public abstract String getElementName(T element) throws XML2JavaMapperException; + + public abstract boolean isTextElement(T element) throws XML2JavaMapperException; + + public abstract T getRootElement(T element) throws XML2JavaMapperException; + + public Class getTargetType() { + return Object.class; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/XML2JavaMapperException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/XML2JavaMapperException.java new file mode 100644 index 0000000000..dfdd54084b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/XML2JavaMapperException.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.javabeans; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.api.TuscanyRuntimeException; + +/** + * This exception is used to encapsulate and rethrow exceptions that arise out + * of converting XML Data to Java Objects. + */ +public class XML2JavaMapperException extends TuscanyRuntimeException { + private static final long serialVersionUID = 6596530102591630642L; + + private QName xmlElementName; + private String javaFieldName; + private Class javaType; + + public XML2JavaMapperException(String message) { + super(message); + } + + public XML2JavaMapperException(Throwable cause) { + super(cause); + } + + public QName getXmlElementName() { + return xmlElementName; + } + + public void setXmlElementName(QName xmlElementName) { + this.xmlElementName = xmlElementName; + } + + public String getJavaFieldName() { + return javaFieldName; + } + + public void setJavaFieldName(String javaFieldName) { + this.javaFieldName = javaFieldName; + } + + public Class getJavaType() { + return javaType; + } + + public void setJavaType(Class javaType) { + this.javaType = javaType; + } + + @Override + public String getMessage() { + return super.getMessage() + " <" + getJavaFieldName() + "> " + " in <" + getJavaType() + ">"; + } + + + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/BeanUtil.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/BeanUtil.java new file mode 100644 index 0000000000..34e3e07843 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/BeanUtil.java @@ -0,0 +1,196 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import java.beans.BeanInfo; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension; +import org.apache.tuscany.spi.idl.TypeInfo; + +public final class BeanUtil { + private static final Object[] NULL = (Object[])null; + private static int nsCount = 1; + + private static final SimpleTypeMapperExtension MAPPER = new SimpleTypeMapperExtension(); + + private BeanUtil() { + } + + private static boolean isSimpleType(Class javaType) { + return MAPPER.getXMLType(javaType) != null; + } + + private static String getStringValue(Object o) { + if (o == null) { + return null; + } + TypeInfo info = MAPPER.getXMLType(o.getClass()); + if (info != null) { + return MAPPER.toXMLLiteral(info.getQName(), o, null); + } else { + return String.valueOf(o); + } + } + + /** + * To Serilize Bean object this method is used, this will create an object + * array using given bean object + * + * @param beanObject + * @param beanName + */ + public static XMLStreamReader getXMLStreamReader(Object beanObject, QName beanName) { + try { + ClassLoader cl = beanObject.getClass().getClassLoader(); + if (cl == null) { + cl = ClassLoader.getSystemClassLoader(); + } + String beanNS = beanName.getNamespaceURI(); + String beanPrefix = beanName.getPrefix(); + BeanInfo beanInfo = Introspector.getBeanInfo(beanObject.getClass()); + PropertyDescriptor[] propDescs = beanInfo.getPropertyDescriptors(); + Map propertMap = new HashMap(); + for (int i = 0; i < propDescs.length; i++) { + PropertyDescriptor propDesc = propDescs[i]; + propertMap.put(propDesc.getName(), propDesc); + } + List properties = new ArrayList(propertMap.keySet()); + Collections.sort(properties); + List props = new ArrayList(); + for (int i = 0; i < properties.size(); i++) { + String property = properties.get(i); + PropertyDescriptor propDesc = (PropertyDescriptor)propertMap.get(property); + if (propDesc == null) { + // JAM does bad thing so I need to add this + continue; + } + Class ptype = propDesc.getPropertyType(); + if ("class".equals(property)) { + continue; + } + if (isSimpleType(ptype)) { + Object value = propDesc.getReadMethod().invoke(beanObject, NULL); + NamedProperty prop = + new NamedProperty(new QName(beanNS, property, beanPrefix), getStringValue(value)); + props.add(prop); + } else if (ptype.isArray()) { + if (isSimpleType(ptype.getComponentType())) { + Object value = propDesc.getReadMethod().invoke(beanObject, NULL); + if (value != null) { + int i1 = Array.getLength(value); + for (int j = 0; j < i1; j++) { + Object o = Array.get(value, j); + NamedProperty prop = + new NamedProperty(new QName(beanNS, property, beanPrefix), getStringValue(o)); + props.add(prop); + } + } else { + NamedProperty prop = new NamedProperty(new QName(beanNS, property, beanPrefix), value); + props.add(prop); + } + + } else { + Object value[] = (Object[])propDesc.getReadMethod().invoke(beanObject, NULL); + if (value != null) { + for (int j = 0; j < value.length; j++) { + Object o = value[j]; + NamedProperty prop = + new NamedProperty(new QName(beanNS, property, beanPrefix), getStringValue(o)); + props.add(prop); + } + } else { + NamedProperty prop = new NamedProperty(new QName(beanNS, property, beanPrefix), value); + props.add(prop); + } + } + } else if (Collection.class.isAssignableFrom(ptype)) { + Object value = propDesc.getReadMethod().invoke(beanObject, NULL); + Collection objList = (Collection)value; + if (objList != null && objList.size() > 0) { + // this was given error , when the array.size = 0 + // and if the array contain simple type , then the + // ADBPullParser asked + // PullParser from That simpel type + for (Iterator j = objList.iterator(); j.hasNext();) { + Object o = j.next(); + if (isSimpleType(o.getClass())) { + NamedProperty prop = + new NamedProperty(new QName(beanNS, property, beanPrefix), getStringValue(o)); + props.add(prop); + } else { + NamedProperty prop = new NamedProperty(new QName(beanNS, property, beanPrefix), o); + props.add(prop); + } + } + + } else { + NamedProperty prop = new NamedProperty(new QName(beanNS, property, beanPrefix), value); + props.add(prop); + } + } else { + Object value = propDesc.getReadMethod().invoke(beanObject, NULL); + NamedProperty prop = new NamedProperty(new QName(beanNS, property, beanPrefix), value); + props.add(prop); + } + } + NamedProperty[] elements = new NamedProperty[props.size()]; + props.toArray(elements); + return new XMLFragmentStreamReaderImpl(beanName, elements, null); + } catch (Exception e) { + throw new IllegalArgumentException(e); + } + } + + /** + * to get the pull parser for a given bean object , generate the wrpper + * element using class name + * + * @param beanObject + */ + public static XMLStreamReader getXMLStreamReader(Object beanObject) { + String className = beanObject.getClass().getName(); + if (className.indexOf(".") > 0) { + className = className.substring(className.lastIndexOf('.') + 1, className.length()); + } + return getXMLStreamReader(beanObject, new QName(className)); + } + + /** + * increments the namespace counter and returns a new prefix + * + * @return unique prefix + */ + public static String getUniquePrefix() { + return "s" + nsCount++; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMDataBinding.java new file mode 100644 index 0000000000..a3f13663bc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMDataBinding.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + + +import org.w3c.dom.Node; + +import org.apache.tuscany.spi.databinding.WrapperHandler; +import org.apache.tuscany.spi.databinding.extension.DataBindingExtension; + +/** + * DOM DataBinding + * + * @version $Rev$ $Date$ + */ +public class DOMDataBinding extends DataBindingExtension { + public static final String NAME = Node.class.getName(); + public static final String[] ALIASES = new String[] {"dom"}; + + public DOMDataBinding() { + super(NAME, ALIASES, Node.class); + } + + @Override + public WrapperHandler getWrapperHandler() { + return new DOMWrapperHandler(); + } + + public Object copy(Object source) { + if (Node.class.isAssignableFrom(source.getClass())) { + Node nodeSource = (Node) source; + return nodeSource.cloneNode(true); + } + return super.copy(source); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMWrapperHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMWrapperHandler.java new file mode 100644 index 0000000000..6aac20e98f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMWrapperHandler.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.xml; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.namespace.QName; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.WrapperHandler; +import org.apache.tuscany.spi.databinding.extension.DOMHelper; +import org.apache.tuscany.spi.idl.ElementInfo; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +public class DOMWrapperHandler implements WrapperHandler { + + private Document document; + + public DOMWrapperHandler() { + super(); + try { + this.document = DOMHelper.newDocument(); + } catch (ParserConfigurationException e) { + throw new TransformationException(e); + } + } + + public Node create(ElementInfo element, TransformationContext context) { + QName name = element.getQName(); + return DOMHelper.createElement(document, name); + } + + public void setChild(Node wrapper, int i, ElementInfo childElement, Object value) { + Node node = (Node) value; + if (node.getNodeType() == Node.DOCUMENT_NODE) { + node = ((Document) node).getDocumentElement(); + } + wrapper.appendChild(wrapper.getOwnerDocument().importNode(node, true)); + } + + public List getChildren(Node wrapper) { + assert wrapper != null; + if (wrapper.getNodeType() == Node.DOCUMENT_NODE) { + wrapper = ((Document) wrapper).getDocumentElement(); + } + List elements = new ArrayList(); + NodeList nodes = wrapper.getChildNodes(); + for (int j = 0; j < nodes.getLength(); j++) { + Node node = nodes.item(j); + if (node.getNodeType() == Node.ELEMENT_NODE) { + elements.add(node); + } + } + return elements; + } +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMXMLStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMXMLStreamReader.java new file mode 100644 index 0000000000..39adcf332d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMXMLStreamReader.java @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import static javax.xml.XMLConstants.DEFAULT_NS_PREFIX; +import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.w3c.dom.Attr; +import org.w3c.dom.CharacterData; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +public class DOMXMLStreamReader extends XMLFragmentStreamReaderImpl { + private Element rootElement; + + public DOMXMLStreamReader(Node node) { + super(null); + switch (node.getNodeType()) { + case Node.DOCUMENT_NODE: + this.rootElement = ((Document)node).getDocumentElement(); + break; + case Node.ELEMENT_NODE: + this.rootElement = (Element)node; + break; + default: + throw new IllegalArgumentException("Illegal Node"); + } + String ns = rootElement.getNamespaceURI(); + String prefix = rootElement.getPrefix(); + String name = rootElement.getLocalName(); + elementQName = new QName(ns == null ? "" : ns, name, prefix == null ? "" : prefix); + } + + @Override + protected final NamedProperty[] getAttributes() { + if (attributes == null) { + List attributeList = new ArrayList(); + NamedNodeMap nodeMap = rootElement.getAttributes(); + for (int i = 0; i < nodeMap.getLength(); i++) { + Attr attr = (Attr)nodeMap.item(i); + String ns = attr.getNamespaceURI(); + String prefix = attr.getPrefix(); + if (!XMLNS_ATTRIBUTE_NS_URI.equals(ns)) { + QName attrName = new QName(ns == null ? "" : ns, attr.getLocalName(), prefix != null ? prefix : ""); + NamedProperty pair = new NamedProperty(attrName, attr.getValue()); + attributeList.add(pair); + } + } + attributes = new NamedProperty[attributeList.size()]; + attributeList.toArray(attributes); + } + return attributes; + } + + @Override + protected QName[] getNamespaces() { + List nsList = new ArrayList(); + NamedNodeMap nodeMap = rootElement.getAttributes(); + for (int i = 0; i < nodeMap.getLength(); i++) { + Attr attr = (Attr)nodeMap.item(i); + String ns = attr.getNamespaceURI(); + if (XMLNS_ATTRIBUTE_NS_URI.equals(ns)) { + String prefix = attr.getPrefix(); + if (prefix == null) { + // xmlns="http://ns" + nsList.add(new QName(attr.getValue(), "", DEFAULT_NS_PREFIX)); + } else { + // xmlns:ns="http://ns" + nsList.add(new QName(attr.getValue(), "", attr.getLocalName())); + } + } + } + QName[] nss = new QName[nsList.size()]; + nsList.toArray(nss); + return nss; + } + + @Override + protected NamedProperty[] getElements() { + if (elements == null) { + List elementList = new ArrayList(); + NodeList nodeList = rootElement.getChildNodes(); + for (int i = 0; i < nodeList.getLength(); i++) { + Node node = nodeList.item(i); + switch (node.getNodeType()) { + case Node.TEXT_NODE: + case Node.CDATA_SECTION_NODE: + NamedProperty pair = new NamedProperty(ELEMENT_TEXT, ((CharacterData)node).getData()); + elementList.add(pair); + break; + + case Node.ELEMENT_NODE: + Element element = (Element)node; + QName elementName = new QName(element.getNamespaceURI(), element.getLocalName()); + pair = new NamedProperty(elementName, new DOMXMLStreamReader(element)); + elementList.add(pair); + break; + } + } + elements = new NamedProperty[elementList.size()]; + elementList.toArray(elements); + } + return elements; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DelegatingNamespaceContext.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DelegatingNamespaceContext.java new file mode 100644 index 0000000000..1edc52c089 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DelegatingNamespaceContext.java @@ -0,0 +1,310 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import java.util.ArrayList; +import java.util.EmptyStackException; +import java.util.Iterator; +import java.util.List; + +import javax.xml.namespace.NamespaceContext; + +public class DelegatingNamespaceContext implements NamespaceContext { + private static int count; + + private class WrappingIterator implements Iterator { + + private Iterator containedIterator; + + public WrappingIterator(Iterator containedIterator) { + this.containedIterator = containedIterator; + } + + public Iterator getContainedIterator() { + return containedIterator; + } + + public boolean hasNext() { + return containedIterator.hasNext(); + } + + public Object next() { + return containedIterator.next(); + } + + /** + * As per the contract on the API of Namespace context the returned iterator should be immutable + */ + public void remove() { + throw new UnsupportedOperationException(); + } + + public void setContainedIterator(Iterator containedIterator) { + this.containedIterator = containedIterator; + } + } + + private NamespaceContext parentNsContext; + + private FastStack prefixStack = new FastStack(); + + // Keep two arraylists for the prefixes and namespaces. They should be in + // sync + // since the index of the entry will be used to relate them + // use the minimum initial capacity to let things handle memory better + + private FastStack uriStack = new FastStack(); + + /** + * Generates a unique namespace prefix that is not in the scope of the NamespaceContext + * + * @return string + */ + public String generateUniquePrefix() { + String prefix = "p" + count++; + // null should be returned if the prefix is not bound! + while (getNamespaceURI(prefix) != null) { + prefix = "p" + count++; + } + + return prefix; + } + + public String getNamespaceURI(String prefix) { + // do the corrections as per the javadoc + int index = prefixStack.search(prefix); + if (index != -1) { + return (String)uriStack.get(index); + } + if (parentNsContext != null) { + return parentNsContext.getPrefix(prefix); + } + return null; + } + + public NamespaceContext getParentNsContext() { + return parentNsContext; + } + + public String getPrefix(String uri) { + // do the corrections as per the javadoc + int index = uriStack.search(uri); + if (index != -1) { + return (String)prefixStack.get(index); + } + + if (parentNsContext != null) { + return parentNsContext.getPrefix(uri); + } + return null; + } + + public Iterator getPrefixes(String uri) { + // create an arraylist that contains the relevant prefixes + String[] uris = (String[])uriStack.toArray(new String[uriStack.size()]); + List tempList = new ArrayList(); + for (int i = uris.length - 1; i >= 0; i--) { + if (uris[i].equals(uri)) { + tempList.add(prefixStack.get(i)); + // we assume that array conversion preserves the order + } + } + // by now all the relevant prefixes are collected + // make a new iterator and provide a wrapper iterator to + // obey the contract on the API + return new WrappingIterator(tempList.iterator()); + } + + /** + * Pop a namespace + */ + public void popNamespace() { + prefixStack.pop(); + uriStack.pop(); + } + + /** + * Register a namespace in this context + * + * @param prefix + * @param uri + */ + public void pushNamespace(String prefix, String uri) { + prefixStack.push(prefix); + uriStack.push(uri); + + } + + public void setParentNsContext(NamespaceContext parentNsContext) { + this.parentNsContext = parentNsContext; + } + + /** + * An implementation of the {@link java.util.Stack} API that is based on an ArrayList instead of a + * Vector, so it is not synchronized to protect against multi-threaded access. The implementation is + * therefore operates faster in environments where you do not need to worry about multiple thread contention. + *

+ * The removal order of an ArrayStack is based on insertion order: The most recently added element is + * removed first. The iteration order is not the same as the removal order. The iterator returns elements + * from the bottom up, whereas the {@link #remove()} method removes them from the top down. + *

+ * Unlike Stack, ArrayStack accepts null entries. + */ + public static class FastStack extends ArrayList { + + /** Ensure serialization compatibility */ + private static final long serialVersionUID = 2130079159931574599L; + + /** + * Constructs a new empty ArrayStack. The initial size is controlled by ArrayList + * and is currently 10. + */ + public FastStack() { + super(); + } + + /** + * Constructs a new empty ArrayStack with an initial size. + * + * @param initialSize the initial size to use + * @throws IllegalArgumentException if the specified initial size is negative + */ + public FastStack(int initialSize) { + super(initialSize); + } + + /** + * Return true if this stack is currently empty. + *

+ * This method exists for compatibility with java.util.Stack. New users of this class should use + * isEmpty instead. + * + * @return true if the stack is currently empty + */ + public boolean empty() { + return isEmpty(); + } + + /** + * Returns the top item off of this stack without removing it. + * + * @return the top item on the stack + * @throws EmptyStackException if the stack is empty + */ + public T peek() throws EmptyStackException { + int n = size(); + if (n <= 0) { + throw new EmptyStackException(); + } else { + return get(n - 1); + } + } + + /** + * Returns the n'th item down (zero-relative) from the top of this stack without removing it. + * + * @param n the number of items down to go + * @return the n'th item on the stack, zero relative + * @throws EmptyStackException if there are not enough items on the stack to satisfy this request + */ + public T peek(int n) throws EmptyStackException { + int m = (size() - n) - 1; + if (m < 0) { + throw new EmptyStackException(); + } else { + return get(m); + } + } + + /** + * Pops the top item off of this stack and return it. + * + * @return the top item on the stack + * @throws EmptyStackException if the stack is empty + */ + public T pop() throws EmptyStackException { + int n = size(); + if (n <= 0) { + throw new EmptyStackException(); + } else { + return remove(n - 1); + } + } + + /** + * Pushes a new item onto the top of this stack. The pushed item is also returned. This is equivalent to calling + * add. + * + * @param item the item to be added + * @return the item just pushed + */ + public Object push(T item) { + add(item); + return item; + } + + /** + * Returns the top-most index for the object in the stack + * + * @param object the object to be searched for + * @return top-most index, or -1 if not found + */ + public int search(T object) { + int i = size() - 1; // Current index + while (i >= 0) { + T current = get(i); + if ((object == null && current == null) || (object != null && object.equals(current))) { + return i; + } + i--; + } + return -1; + } + + /** + * Returns the element on the top of the stack. + * + * @return the element on the top of the stack + * @throws EmptyStackException if the stack is empty + */ + public T get() { + int size = size(); + if (size == 0) { + throw new EmptyStackException(); + } + return get(size - 1); + } + + /** + * Removes the element on the top of the stack. + * + * @return the removed element + * @throws EmptyStackException if the stack is empty + */ + public T remove() { + int size = size(); + if (size == 0) { + throw new EmptyStackException(); + } + return remove(size - 1); + } + + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputSource2Node.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputSource2Node.java new file mode 100644 index 0000000000..e9757fa13c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputSource2Node.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import javax.xml.transform.Source; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; +import org.w3c.dom.Node; +import org.xml.sax.InputSource; + +/** + * Push DOM InputSource to Node + */ +@Service(Transformer.class) +public class InputSource2Node extends TransformerExtension implements + PullTransformer { + private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer(); + + public Node transform(InputSource source, TransformationContext context) { + try { + Source streamSource = new StreamSource(source.getCharacterStream()); + DOMResult result = new DOMResult(); + TRANSFORMER.transform(streamSource, result, context); + return result.getNode(); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return InputSource.class; + } + + public Class getTargetType() { + return Node.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputSource2SAX.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputSource2SAX.java new file mode 100644 index 0000000000..be78a07ede --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputSource2SAX.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import org.apache.tuscany.spi.databinding.PushTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; +import org.xml.sax.ContentHandler; +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.XMLReaderFactory; + +/** + * Push InputSource to SAX + */ +@Service(Transformer.class) +public class InputSource2SAX extends TransformerExtension implements + PushTransformer { + + public void transform(InputSource source, ContentHandler target, TransformationContext context) { + try { + XMLReader reader = XMLReaderFactory.createXMLReader(); + reader.setFeature("http://xml.org/sax/features/namespaces", true); + reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false); + reader.setContentHandler(target); + reader.parse(source); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return InputSource.class; + } + + public Class getTargetType() { + return ContentHandler.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputStream2Node.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputStream2Node.java new file mode 100644 index 0000000000..e103c82b33 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputStream2Node.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import java.io.InputStream; + +import javax.xml.transform.Source; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.sax.SAXSource; + +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; +import org.w3c.dom.Node; +import org.xml.sax.InputSource; + +/** + * Push DOM InputSource to Node + */ +@Service(Transformer.class) +public class InputStream2Node extends TransformerExtension implements + PullTransformer { + private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer(); + + public Node transform(InputStream source, TransformationContext context) { + try { + Source streamSource = new SAXSource(new InputSource(source)); + DOMResult result = new DOMResult(); + TRANSFORMER.transform(streamSource, result, context); + return result.getNode(); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return InputStream.class; + } + + public Class getTargetType() { + return Node.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputStream2SAX.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputStream2SAX.java new file mode 100644 index 0000000000..d74863ea95 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputStream2SAX.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import java.io.InputStream; + +import org.apache.tuscany.spi.databinding.PushTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; +import org.xml.sax.ContentHandler; +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.XMLReaderFactory; + +/** + * Push InputStream to SAX + */ +@Service(Transformer.class) +public class InputStream2SAX extends TransformerExtension implements + PushTransformer { + public void transform(InputStream source, ContentHandler target, TransformationContext context) { + try { + XMLReader reader = XMLReaderFactory.createXMLReader(); + reader.setContentHandler(target); + reader.parse(new InputSource(source)); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return InputStream.class; + } + + public Class getTargetType() { + return ContentHandler.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NameValueArrayStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NameValueArrayStreamReader.java new file mode 100644 index 0000000000..d10af29b35 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NameValueArrayStreamReader.java @@ -0,0 +1,403 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; +import javax.xml.stream.Location; +import javax.xml.stream.XMLStreamException; + +public class NameValueArrayStreamReader implements XMLFragmentStreamReader { + + private static final int START_ELEMENT_STATE = 0; + private static final int TEXT_STATE = 1; + private static final int END_ELEMENT_STATE = 2; + private static final int FINAL_END_ELEMENT_STATE = 3; + private static final int START_ELEMENT_STATE_WITH_NULL = 4; + + private DelegatingNamespaceContext namespaceContext = new DelegatingNamespaceContext(); + // the index of the array + private int arrayIndex; + + private QName name; + private String[] values; + + // start element is the default state + private int state = START_ELEMENT_STATE; + + public NameValueArrayStreamReader(QName name, String[] values) { + this.name = name; + this.values = values; + } + + public void setParentNamespaceContext(NamespaceContext nsContext) { + this.namespaceContext.setParentNsContext(nsContext); + } + + public void init() { + // todo what if the Qname namespace has not been declared + } + + public Object getProperty(String string) throws IllegalArgumentException { + return null; + } + + /** + * @throws XMLStreamException + */ + public int next() throws XMLStreamException { + switch (state) { + case START_ELEMENT_STATE: + if (values.length > 0) { + state = TEXT_STATE; + return CHARACTERS; + } else { + state = FINAL_END_ELEMENT_STATE; + return END_ELEMENT; + } + + case START_ELEMENT_STATE_WITH_NULL: + if (arrayIndex == (values.length - 1)) { + state = FINAL_END_ELEMENT_STATE; + } else { + state = END_ELEMENT_STATE; + } + return END_ELEMENT; + case FINAL_END_ELEMENT_STATE: + // oops, not supposed to happen! + throw new XMLStreamException("end already reached!"); + case END_ELEMENT_STATE: + // we've to have more values since this is not the + // last value + // increment the counter + arrayIndex++; + if (values[arrayIndex] == null) { + state = START_ELEMENT_STATE_WITH_NULL; + } else { + state = START_ELEMENT_STATE; + } + return START_ELEMENT; + case TEXT_STATE: + if (arrayIndex == (values.length - 1)) { + state = FINAL_END_ELEMENT_STATE; + return END_ELEMENT; + } else { + state = END_ELEMENT_STATE; + return END_ELEMENT; + } + + default: + throw new XMLStreamException("unknown event type!"); + } + } + + public void require(int i, String string, String string1) throws XMLStreamException { + // nothing done here + } + + public String getElementText() throws XMLStreamException { + return null; // not implemented + } + + public int nextTag() throws XMLStreamException { + return 0; // not implemented + } + + public String getAttributeValue(String string, String string1) { + if (state == TEXT_STATE) { + // todo something + return null; + } else { + return null; + } + + } + + public int getAttributeCount() { + if (state == START_ELEMENT_STATE_WITH_NULL) { + return 1; + } + if (state == START_ELEMENT_STATE) { + return 0; + } else { + throw new IllegalStateException(); + } + + } + + public QName getAttributeName(int i) { + if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) { + return NIL_QNAME; + } + if (state == START_ELEMENT_STATE) { + return null; + } else { + throw new IllegalStateException(); + } + } + + public String getAttributeNamespace(int i) { + if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) { + return NIL_QNAME.getNamespaceURI(); + } + if (state == START_ELEMENT_STATE) { + return null; + } else { + throw new IllegalStateException(); + } + } + + public String getAttributeLocalName(int i) { + if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) { + return NIL_QNAME.getLocalPart(); + } + if (state == START_ELEMENT_STATE) { + return null; + } else { + throw new IllegalStateException(); + } + } + + public String getAttributePrefix(int i) { + if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) { + return NIL_QNAME.getPrefix(); + } + if (state == START_ELEMENT_STATE) { + return null; + } else { + throw new IllegalStateException(); + } + } + + public String getAttributeType(int i) { + return null; // not implemented + } + + public String getAttributeValue(int i) { + if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) { + return NIL_VALUE_TRUE; + } + if (state == START_ELEMENT_STATE) { + return null; + } else { + throw new IllegalStateException(); + } + } + + public boolean isAttributeSpecified(int i) { + return false; // not supported + } + + public int getNamespaceCount() { + if (state == START_ELEMENT_STATE_WITH_NULL && isXsiNamespacePresent()) { + return 1; + } else { + return 0; + } + + } + + public String getNamespacePrefix(int i) { + if (state == START_ELEMENT_STATE_WITH_NULL && isXsiNamespacePresent() && i == 0) { + return NIL_QNAME.getPrefix(); + } else { + return null; + } + } + + public String getNamespaceURI(int i) { + if (state == START_ELEMENT_STATE_WITH_NULL && isXsiNamespacePresent() && i == 0) { + return NIL_QNAME.getNamespaceURI(); + } else { + return null; + } + } + + public NamespaceContext getNamespaceContext() { + return this.namespaceContext; + } + + public boolean isDone() { + return state == FINAL_END_ELEMENT_STATE; + } + + public int getEventType() { + switch (state) { + case START_ELEMENT_STATE: + return START_ELEMENT; + case END_ELEMENT_STATE: + return END_ELEMENT; + case TEXT_STATE: + return CHARACTERS; + case FINAL_END_ELEMENT_STATE: + return END_ELEMENT; + default: + throw new UnsupportedOperationException(); + // we've no idea what this is!!!!! + } + + } + + public String getText() { + if (state == TEXT_STATE) { + return values[arrayIndex]; + } else { + throw new IllegalStateException(); + } + } + + public char[] getTextCharacters() { + if (state == TEXT_STATE) { + return values[arrayIndex].toCharArray(); + } else { + throw new IllegalStateException(); + } + } + + public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException { + // not implemented + throw new UnsupportedOperationException(); + } + + public int getTextStart() { + if (state == TEXT_STATE) { + return 0; + } else { + throw new IllegalStateException(); + } + } + + public int getTextLength() { + if (state == TEXT_STATE) { + return values[arrayIndex].length(); + } else { + throw new IllegalStateException(); + } + + } + + public String getEncoding() { + return null; + } + + public boolean hasText() { + return state == TEXT_STATE; + } + + public Location getLocation() { + return null; // not supported + } + + public QName getName() { + if (state != TEXT_STATE) { + return name; + } else { + return null; + } + } + + public String getLocalName() { + if (state != TEXT_STATE) { + return name.getLocalPart(); + } else { + return null; + } + } + + public boolean hasName() { + return state != TEXT_STATE; + + } + + public String getNamespaceURI() { + if (state != TEXT_STATE) { + return name.getNamespaceURI(); + } else { + return null; + } + + } + + public String getPrefix() { + if (state != TEXT_STATE) { + return name.getPrefix(); + } else { + return null; + } + } + + public String getVersion() { + return null; // todo 1.0 ? + } + + public boolean isStandalone() { + return false; + } + + public boolean standaloneSet() { + return false; + } + + public String getCharacterEncodingScheme() { + return null; + } + + public String getPITarget() { + return null; + } + + public String getPIData() { + return null; + } + + public boolean hasNext() throws XMLStreamException { + return state != FINAL_END_ELEMENT_STATE; + } + + public void close() throws XMLStreamException { + // Do nothing - we've nothing to free here + } + + public String getNamespaceURI(String prefix) { + return namespaceContext.getNamespaceURI(prefix); + } + + public boolean isStartElement() { + return state == START_ELEMENT_STATE; + } + + public boolean isEndElement() { + return state == END_ELEMENT_STATE; + } + + public boolean isCharacters() { + return state == TEXT_STATE; + } + + public boolean isWhiteSpace() { + return false; // no whitespaces here + } + + /** + * Test whether the xsi namespace is present + */ + private boolean isXsiNamespacePresent() { + return namespaceContext.getNamespaceURI(NIL_QNAME.getPrefix()) != null; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NameValuePairStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NameValuePairStreamReader.java new file mode 100644 index 0000000000..d9261b8b4f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NameValuePairStreamReader.java @@ -0,0 +1,347 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; +import javax.xml.stream.Location; +import javax.xml.stream.XMLStreamException; + + +public class NameValuePairStreamReader implements XMLFragmentStreamReader { + + private static final int START_ELEMENT_STATE = 0; + private static final int TEXT_STATE = 1; + private static final int END_ELEMENT_STATE = 2; + + private DelegatingNamespaceContext namespaceContext = new DelegatingNamespaceContext(); + + private QName name; + private String value; + + private int state = START_ELEMENT_STATE; + // initiate at the start element state + + // keeps track whether the namespace is declared + // false by default + private boolean nsDeclared; + + public NameValuePairStreamReader(QName name, String value) { + this.name = name; + this.value = value; + } + + public Object getProperty(String key) throws IllegalArgumentException { + return null; + } + + public int next() throws XMLStreamException { + // no need to handle null here. it should have been handled + // already + switch (state) { + case START_ELEMENT_STATE: + state = TEXT_STATE; + return CHARACTERS; + case END_ELEMENT_STATE: + // oops, not supposed to happen! + throw new XMLStreamException("end already reached!"); + case TEXT_STATE: + state = END_ELEMENT_STATE; + return END_ELEMENT; + default: + throw new XMLStreamException("unknown event type!"); + } + } + + public void require(int i, String string, String string1) throws XMLStreamException { + // not implemented + } + + public String getElementText() throws XMLStreamException { + if (state == START_ELEMENT) { + // move to the end state and return the value + state = END_ELEMENT_STATE; + return value; + } else { + throw new XMLStreamException(); + } + + } + + public int nextTag() throws XMLStreamException { + return 0; // todo + } + + public boolean hasNext() throws XMLStreamException { + return state != END_ELEMENT_STATE; + } + + public void close() throws XMLStreamException { + // Do nothing - we've nothing to free here + } + + public String getNamespaceURI(String prefix) { + return namespaceContext.getNamespaceURI(prefix); + } + + public boolean isStartElement() { + return state == START_ELEMENT_STATE; + } + + public boolean isEndElement() { + return state == END_ELEMENT_STATE; + } + + public boolean isCharacters() { + return state == TEXT_STATE; + } + + public boolean isWhiteSpace() { + return false; // no whitespaces here + } + + public String getAttributeValue(String string, String string1) { + return null; + } + + public int getAttributeCount() { + return 0; + } + + public QName getAttributeName(int i) { + return null; + } + + public String getAttributeNamespace(int i) { + return null; + } + + public String getAttributeLocalName(int i) { + return null; + } + + public String getAttributePrefix(int i) { + return null; + } + + public String getAttributeType(int i) { + return null; + } + + public String getAttributeValue(int i) { + return null; + } + + public boolean isAttributeSpecified(int i) { + return false; // no attribs here + } + + public int getNamespaceCount() { + return nsDeclared ? 1 : 0; + } + + public String getNamespacePrefix(int i) { + return (nsDeclared && i == 0) ? name.getPrefix() : null; + } + + public String getNamespaceURI(int i) { + return (nsDeclared && i == 0) ? name.getNamespaceURI() : null; + } + + public NamespaceContext getNamespaceContext() { + return this.namespaceContext; + } + + public int getEventType() { + switch (state) { + case START_ELEMENT_STATE: + return START_ELEMENT; + case END_ELEMENT_STATE: + return END_ELEMENT; + case TEXT_STATE: + return CHARACTERS; + default: + throw new UnsupportedOperationException(); + // we've no idea what this is!!!!! + } + + } + + public String getText() { + if (state == TEXT_STATE) { + return value; + } else { + throw new IllegalStateException(); + } + } + + public char[] getTextCharacters() { + if (state == TEXT_STATE) { + return value.toCharArray(); + } else { + throw new IllegalStateException(); + } + } + + public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException { + // not implemented + throw new UnsupportedOperationException(); + } + + public int getTextStart() { + if (state == TEXT_STATE) { + return 0; + } else { + throw new IllegalStateException(); + } + } + + public int getTextLength() { + if (state == TEXT_STATE) { + return value.length(); + } else { + throw new IllegalStateException(); + } + + } + + public String getEncoding() { + return null; + } + + public boolean hasText() { + return state == TEXT_STATE; + } + + public Location getLocation() { + return new Location() { + public int getLineNumber() { + return 0; + } + + public int getColumnNumber() { + return 0; + } + + public int getCharacterOffset() { + return 0; + } + + public String getPublicId() { + return null; + } + + public String getSystemId() { + return null; + } + }; + } + + public QName getName() { + if (state != TEXT_STATE) { + return name; + } else { + return null; + } + } + + public String getLocalName() { + if (state != TEXT_STATE) { + return name.getLocalPart(); + } else { + return null; + } + } + + public boolean hasName() { + return state != TEXT_STATE; + + } + + public String getNamespaceURI() { + if (state != TEXT_STATE) { + return name.getNamespaceURI(); + } else { + return null; + } + + } + + public String getPrefix() { + if (state != TEXT_STATE) { + return name.getPrefix(); + } else { + return null; + } + } + + public String getVersion() { + return null; // todo 1.0 ? + } + + public boolean isStandalone() { + return false; + } + + public boolean standaloneSet() { + return false; + } + + public String getCharacterEncodingScheme() { + return null; + } + + public String getPITarget() { + return null; + } + + public String getPIData() { + return null; + } + + public boolean isDone() { + return state == END_ELEMENT_STATE; + } + + public void setParentNamespaceContext(NamespaceContext nsContext) { + this.namespaceContext.setParentNsContext(nsContext); + } + + public void init() { + // just add the current elements namespace and prefix to the this + // elements nscontext + addToNsMap(name.getPrefix(), name.getNamespaceURI()); + + } + + /** + * @param prefix + * @param uri + */ + private void addToNsMap(String prefix, String uri) { + // todo - need to fix this up to cater for cases where + // namespaces are having no prefixes + if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) { + // this namespace is not there. Need to declare it + namespaceContext.pushNamespace(prefix, uri); + nsDeclared = true; + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NamedProperty.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NamedProperty.java new file mode 100644 index 0000000000..0ce249e912 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NamedProperty.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.core.databinding.xml; + +import java.util.Map; + +import javax.xml.namespace.QName; + +/** + * A named property + * + * @version $Rev$ $Date$ + */ +public class NamedProperty implements Map.Entry { + private QName key; + + private Object value; + + public NamedProperty(QName key, Object value) { + this.key = key; + this.value = value; + } + + public NamedProperty(String key, Object value) { + this.key = new QName(key); + this.value = value; + } + + public QName getKey() { + return key; + } + + public Object getValue() { + return value; + } + + public Object setValue(Object value) { + Object v = this.value; + this.value = value; + return v; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NilElementStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NilElementStreamReader.java new file mode 100644 index 0000000000..8a454c8342 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NilElementStreamReader.java @@ -0,0 +1,279 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; +import javax.xml.stream.Location; +import javax.xml.stream.XMLStreamException; + +public class NilElementStreamReader implements XMLFragmentStreamReader { + + private static final int END_ELEMENT_STATE = 2; + + private static final int START_ELEMENT_STATE = 1; + private int currentState = START_ELEMENT; + + private QName elementQName; + + public NilElementStreamReader(QName elementQName) { + this.elementQName = elementQName; + } + + public void setParentNamespaceContext(NamespaceContext nsContext) { + // NOOP + } + + public void close() throws XMLStreamException { + // do nothing + } + + public int getAttributeCount() { + return 1; + } + + public String getAttributeLocalName(int i) { + return (i == 0) ? NIL_QNAME.getLocalPart() : null; + } + + public QName getAttributeName(int i) { + return (i == 0) ? NIL_QNAME : null; + } + + public String getAttributeNamespace(int i) { + return (i == 0) ? NIL_QNAME.getNamespaceURI() : null; + } + + public String getAttributePrefix(int i) { + return (i == 0) ? NIL_QNAME.getPrefix() : null; + } + + public String getAttributeType(int i) { + throw new UnsupportedOperationException(); + } + + public String getAttributeValue(int i) { + return (i == 0) ? NIL_VALUE_TRUE : null; + } + + public String getAttributeValue(String string, String string1) { + if (string == null && NIL_QNAME.getLocalPart().equals(string1)) { + return NIL_VALUE_TRUE; + } + return null; + } + + public String getCharacterEncodingScheme() { + throw new UnsupportedOperationException(); + } + + public String getElementText() throws XMLStreamException { + return null; + } + + public String getEncoding() { + return null; + } + + public int getEventType() { + int returnEvent = START_DOCUMENT; + switch (currentState) { + case START_ELEMENT_STATE: + returnEvent = START_ELEMENT; + break; + case END_ELEMENT_STATE: + returnEvent = END_ELEMENT; + break; + } + return returnEvent; + } + + public String getLocalName() { + return elementQName.getLocalPart(); + } + + public Location getLocation() { + return new Location() { + public int getCharacterOffset() { + return 0; + } + + public int getColumnNumber() { + return 0; + } + + public int getLineNumber() { + return 0; + } + + public String getPublicId() { + return null; + } + + public String getSystemId() { + return null; + } + }; + } + + public QName getName() { + return elementQName; + } + + public NamespaceContext getNamespaceContext() { + throw new UnsupportedOperationException(); + } + + public int getNamespaceCount() { + return 0; + } + + public String getNamespacePrefix(int i) { + return null; + } + + public String getNamespaceURI() { + return elementQName.getNamespaceURI(); + } + + public String getNamespaceURI(int i) { + return null; + } + + public String getNamespaceURI(String string) { + if (elementQName.getPrefix() != null && elementQName.getPrefix().equals(string)) { + return elementQName.getNamespaceURI(); + } else { + return null; + } + } + + public String getPIData() { + throw new UnsupportedOperationException(); + } + + public String getPITarget() { + throw new UnsupportedOperationException(); + } + + public String getPrefix() { + return elementQName.getPrefix(); + } + + public Object getProperty(String key) throws IllegalArgumentException { + // since optimization is a global property + // we've to implement it everywhere + return null; + } + + public String getText() { + return null; + } + + public char[] getTextCharacters() { + return new char[0]; + } + + public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException { + return 0; + } + + public int getTextLength() { + return 0; + } + + public int getTextStart() { + return 0; + } + + public String getVersion() { + throw new UnsupportedOperationException(); + } + + public boolean hasName() { + return true; + } + + public boolean hasNext() throws XMLStreamException { + return currentState != END_ELEMENT_STATE; + + } + + public boolean hasText() { + return false; + } + + public void init() { + // NOOP + } + + public boolean isAttributeSpecified(int i) { + return i == 0; + } + + public boolean isCharacters() { + return false; + } + + public boolean isDone() { + return currentState == END_ELEMENT_STATE; + } + + public boolean isEndElement() { + return currentState == END_ELEMENT_STATE; + } + + public boolean isStandalone() { + throw new UnsupportedOperationException(); + } + + public boolean isStartElement() { + return currentState == START_ELEMENT_STATE; + } + + public boolean isWhiteSpace() { + return false; + } + + public int next() throws XMLStreamException { + int returnEvent = START_DOCUMENT; + switch (currentState) { + case START_ELEMENT_STATE: + currentState = END_ELEMENT_STATE; + returnEvent = END_ELEMENT; + break; + case END_ELEMENT_STATE: + throw new XMLStreamException("parser completed!"); + + } + return returnEvent; + } + + public int nextTag() throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + public void require(int i, String string, String string1) throws XMLStreamException { + // nothing + } + + public boolean standaloneSet() { + throw new UnsupportedOperationException(); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2OutputStream.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2OutputStream.java new file mode 100644 index 0000000000..34fbdf8c6f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2OutputStream.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import java.io.OutputStream; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.tuscany.spi.databinding.PushTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; +import org.w3c.dom.Node; + +/** + * Push DOM Node to OutputStream + */ +@Service(Transformer.class) +public class Node2OutputStream extends TransformerExtension implements + PushTransformer { + private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer(); + + public void transform(Node source, OutputStream writer, TransformationContext context) { + try { + Source domSource = new DOMSource(source); + Result result = new StreamResult(writer); + TRANSFORMER.transform(domSource, result, context); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return Node.class; + } + + public Class getTargetType() { + return OutputStream.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2String.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2String.java new file mode 100755 index 0000000000..92378e96a3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2String.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import java.io.StringWriter; + +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; +import org.w3c.dom.Node; + +/** + * Transform DOM Node to XML String + */ +@Service(org.apache.tuscany.spi.databinding.Transformer.class) +public class Node2String extends TransformerExtension implements PullTransformer { + private static final Node2Writer TRANSFORMER = new Node2Writer(); + + public String transform(Node source, TransformationContext context) { + try { + StringWriter writer = new StringWriter(); + TRANSFORMER.transform(source, writer, context); + return writer.toString(); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return Node.class; + } + + public Class getTargetType() { + return String.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2Writer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2Writer.java new file mode 100644 index 0000000000..96328fdd2f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2Writer.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import java.io.Writer; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.tuscany.spi.databinding.PushTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; +import org.w3c.dom.Node; + +/** + * Push DOM Node to Writer + */ +@Service(Transformer.class) +public class Node2Writer extends TransformerExtension implements PushTransformer { + private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer(); + + public void transform(Node source, Writer writer, TransformationContext context) { + try { + Source domSource = new DOMSource(source); + Result result = new StreamResult(writer); + TRANSFORMER.transform(domSource, result, context); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return Node.class; + } + + public Class getTargetType() { + return Writer.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2XMLStreamReader.java new file mode 100644 index 0000000000..0c75826ffa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2XMLStreamReader.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; +import org.w3c.dom.Node; + +/** + * Transform DOM Node to XML XMLStreamReader + */ +@Service(Transformer.class) +public class Node2XMLStreamReader extends TransformerExtension implements + PullTransformer { + + public XMLStreamReader transform(Node source, TransformationContext context) { + try { + DOMXMLStreamReader reader = new DOMXMLStreamReader(source); + return new XMLDocumentStreamReader(reader); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return Node.class; + } + + public Class getTargetType() { + return XMLStreamReader.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Reader2Node.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Reader2Node.java new file mode 100644 index 0000000000..02de055c35 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Reader2Node.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import java.io.Reader; + +import javax.xml.transform.Source; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; +import org.w3c.dom.Node; + +/** + * Push DOM Reader to Node + */ +@Service(Transformer.class) +public class Reader2Node extends TransformerExtension implements PullTransformer { + private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer(); + + public Node transform(Reader source, TransformationContext context) { + try { + Source streamSource = new StreamSource(source); + DOMResult result = new DOMResult(); + TRANSFORMER.transform(streamSource, result, context); + return result.getNode(); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return Reader.class; + } + + public Class getTargetType() { + return Node.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Reader2SAX.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Reader2SAX.java new file mode 100644 index 0000000000..0a4504b3de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Reader2SAX.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import java.io.Reader; + +import org.apache.tuscany.spi.databinding.PushTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; +import org.xml.sax.ContentHandler; +import org.xml.sax.InputSource; + +/** + * Transform XML string to SAX + */ +@Service(Transformer.class) +public class Reader2SAX extends TransformerExtension implements + PushTransformer { + public void transform(Reader source, ContentHandler target, TransformationContext context) { + try { + new InputSource2SAX().transform(new InputSource(source), target, context); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return Reader.class; + } + + public Class getTargetType() { + return ContentHandler.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/SAX2DOM.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/SAX2DOM.java new file mode 100644 index 0000000000..8f8f0f952e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/SAX2DOM.java @@ -0,0 +1,244 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tuscany.core.databinding.xml; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.tuscany.spi.databinding.extension.DOMHelper; +import org.w3c.dom.Comment; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.ProcessingInstruction; +import org.w3c.dom.Text; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.ext.LexicalHandler; + +/** + * SAX2DOM adapter + */ +public class SAX2DOM implements ContentHandler, LexicalHandler { + public static final String EMPTYSTRING = ""; + public static final String XML_PREFIX = "xml"; + public static final String XMLNS_PREFIX = "xmlns"; + public static final String XMLNS_STRING = "xmlns:"; + public static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/"; + + private Node root; + + private Document document; + + private Node nextSibling; + + private Stack nodeStk = new Stack(); + + private List namespaceDecls; + + private Node lastSibling; + + public SAX2DOM() throws ParserConfigurationException { + this.document = DOMHelper.newDocument(); + this.root = document; + } + + public SAX2DOM(Node root, Node nextSibling) throws ParserConfigurationException { + this.root = root; + if (root instanceof Document) { + this.document = (Document)root; + } else if (root != null) { + this.document = root.getOwnerDocument(); + } else { + this.document = DOMHelper.newDocument(); + this.root = document; + } + + this.nextSibling = nextSibling; + } + + public SAX2DOM(Node root) throws ParserConfigurationException { + this(root, null); + } + + public Node getDOM() { + return root; + } + + public void characters(char[] ch, int start, int length) { + final Node last = (Node)nodeStk.peek(); + + // No text nodes can be children of root (DOM006 exception) + if (last != document) { + final String text = new String(ch, start, length); + if (lastSibling != null && lastSibling.getNodeType() == Node.TEXT_NODE) { + ((Text)lastSibling).appendData(text); + } else if (last == root && nextSibling != null) { + lastSibling = last.insertBefore(document.createTextNode(text), nextSibling); + } else { + lastSibling = last.appendChild(document.createTextNode(text)); + } + + } + } + + public void startDocument() { + nodeStk.push(root); + } + + public void endDocument() { + nodeStk.pop(); + } + + public void startElement(String namespace, String localName, String qName, Attributes attrs) { + final Element tmp = (Element)document.createElementNS(namespace, qName); + + // Add namespace declarations first + if (namespaceDecls != null) { + final int nDecls = namespaceDecls.size(); + for (int i = 0; i < nDecls; i++) { + final String prefix = (String)namespaceDecls.get(i++); + + if (prefix == null || prefix.equals(EMPTYSTRING)) { + tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX, (String)namespaceDecls.get(i)); + } else { + tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix, (String)namespaceDecls.get(i)); + } + } + namespaceDecls.clear(); + } + + // Add attributes to element + final int nattrs = attrs.getLength(); + for (int i = 0; i < nattrs; i++) { + if (attrs.getLocalName(i) == null) { + tmp.setAttribute(attrs.getQName(i), attrs.getValue(i)); + } else { + tmp.setAttributeNS(attrs.getURI(i), attrs.getQName(i), attrs.getValue(i)); + } + } + + // Append this new node onto current stack node + Node last = (Node)nodeStk.peek(); + + // If the SAX2DOM is created with a non-null next sibling node, + // insert the result nodes before the next sibling under the root. + if (last == root && nextSibling != null) { + last.insertBefore(tmp, nextSibling); + } else { + last.appendChild(tmp); + } + + // Push this node onto stack + nodeStk.push(tmp); + lastSibling = null; + } + + public void endElement(String namespace, String localName, String qName) { + nodeStk.pop(); + lastSibling = null; + } + + public void startPrefixMapping(String prefix, String uri) { + if (namespaceDecls == null) { + namespaceDecls = new ArrayList(2); + } + namespaceDecls.add(prefix); + namespaceDecls.add(uri); + } + + public void endPrefixMapping(String prefix) { + // do nothing + } + + /** + * This class is only used internally so this method should never be called. + */ + public void ignorableWhitespace(char[] ch, int start, int length) { + } + + /** + * adds processing instruction node to DOM. + */ + public void processingInstruction(String target, String data) { + final Node last = (Node)nodeStk.peek(); + ProcessingInstruction pi = document.createProcessingInstruction(target, data); + if (pi != null) { + if (last == root && nextSibling != null) { + last.insertBefore(pi, nextSibling); + } else { + last.appendChild(pi); + } + + lastSibling = pi; + } + } + + /** + * This class is only used internally so this method should never be called. + */ + public void setDocumentLocator(Locator locator) { + } + + /** + * This class is only used internally so this method should never be called. + */ + public void skippedEntity(String name) { + } + + /** + * Lexical Handler method to create comment node in DOM tree. + */ + public void comment(char[] ch, int start, int length) { + final Node last = (Node)nodeStk.peek(); + Comment comment = document.createComment(new String(ch, start, length)); + if (comment != null) { + if (last == root && nextSibling != null) { + last.insertBefore(comment, nextSibling); + } else { + last.appendChild(comment); + } + + lastSibling = comment; + } + } + + // Lexical Handler methods- not implemented + public void startCDATA() { + } + + public void endCDATA() { + } + + public void startEntity(java.lang.String name) { + } + + public void endDTD() { + } + + public void endEntity(String name) { + } + + public void startDTD(String name, String publicId, String systemId) throws SAXException { + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/SAX2DOMPipe.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/SAX2DOMPipe.java new file mode 100644 index 0000000000..79118b4a2c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/SAX2DOMPipe.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.tuscany.spi.databinding.DataPipe; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; +import org.w3c.dom.Node; +import org.xml.sax.ContentHandler; + +@Service(Transformer.class) +public class SAX2DOMPipe extends TransformerExtension implements + DataPipe { + private SAX2DOM pipe; + + /** + * + */ + public SAX2DOMPipe() { + super(); + try { + this.pipe = new SAX2DOM(); + } catch (ParserConfigurationException e) { + throw new IllegalArgumentException(e); + } + } + + public Node getResult() { + return pipe.getDOM(); + } + + public Class getTargetType() { + return Node.class; + } + + public ContentHandler getSink() { + return pipe; + } + + public Class getSourceType() { + return ContentHandler.class; + } + + public int getWeight() { + return 30; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Source2ResultTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Source2ResultTransformer.java new file mode 100755 index 0000000000..7db14efb39 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Source2ResultTransformer.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.TransformerFactory; + +import org.apache.tuscany.spi.databinding.PushTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; + +/** + * Transform TrAX Source to Result + */ +@Service(org.apache.tuscany.spi.databinding.Transformer.class) +public class Source2ResultTransformer extends TransformerExtension implements + PushTransformer { + private static final TransformerFactory FACTORY = TransformerFactory.newInstance(); + + public void transform(Source source, Result result, TransformationContext context) { + try { + javax.xml.transform.Transformer transformer = FACTORY.newTransformer(); + transformer.transform(source, result); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return Source.class; + } + + public Class getTargetType() { + return Result.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAX2SAXAdapter.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAX2SAXAdapter.java new file mode 100644 index 0000000000..63fa53edb4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAX2SAXAdapter.java @@ -0,0 +1,256 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.core.databinding.xml; + +import javax.xml.namespace.QName; +import javax.xml.stream.Location; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.AttributesImpl; + +/** + * Adapter that converts from StAX to SAX event streams. Currently the following + * SAX events are not generated: + *